@galacean/cli 2.0.0-alpha.24 → 2.0.0-alpha.26

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 (92) hide show
  1. package/dist/cli.bundle.cjs +820 -957
  2. package/dist/preview-client/_static/{Accordion-f938dadf.js → Accordion-2cd014f1.js} +1 -1
  3. package/dist/preview-client/_static/{AmbientLightAsset-e34de607.js → AmbientLightAsset-be9e872c.js} +1 -1
  4. package/dist/preview-client/_static/{AnimationClipAsset-b084da2a.js → AnimationClipAsset-d7b37af0.js} +1 -1
  5. package/dist/preview-client/_static/{AnimatorControllerAsset-6cc04274.js → AnimatorControllerAsset-2716497a.js} +1 -1
  6. package/dist/preview-client/_static/{AnimatorStore-0bc90c37.js → AnimatorStore-883a28ad.js} +1 -1
  7. package/dist/preview-client/_static/{AssetViewer-d2c63b00.js → AssetViewer-3847c058.js} +1 -1
  8. package/dist/preview-client/_static/{AudioAsset-9c715952.js → AudioAsset-c28f33ab.js} +1 -1
  9. package/dist/preview-client/_static/{AudioComponent-80d06ef4.js → AudioComponent-3d6c73ce.js} +1 -1
  10. package/dist/preview-client/_static/{Callout-48e71f13.js → Callout-e2a89f6f.js} +1 -1
  11. package/dist/preview-client/_static/{CameraComponent-9c9db3fb.js → CameraComponent-3dc63451.js} +1 -1
  12. package/dist/preview-client/_static/{Component-b95aa2af.js → Component-0f881fc1.js} +1 -1
  13. package/dist/preview-client/_static/{DirectLight-b0490ef7.js → DirectLight-96dbba47.js} +1 -1
  14. package/dist/preview-client/_static/{FontAsset-6e9c0549.js → FontAsset-d34b5378.js} +1 -1
  15. package/dist/preview-client/_static/{FormItemArray-b2a3d249.js → FormItemArray-b8cda1d2.js} +1 -1
  16. package/dist/preview-client/_static/{GlTFAsset-83e8190e.js → GlTFAsset-5970e707.js} +2 -2
  17. package/dist/preview-client/_static/{IconPlus-172c6c17.js → IconPlus-def01e2b.js} +1 -1
  18. package/dist/preview-client/_static/{IconPointFilled-bad94cf1.js → IconPointFilled-62d3c3b2.js} +1 -1
  19. package/dist/preview-client/_static/{LightBaseComponent-b4854e8a.js → LightBaseComponent-d651a276.js} +1 -1
  20. package/dist/preview-client/_static/{LottieAnimationComponent-efd5da2b.js → LottieAnimationComponent-f10dc558.js} +1 -1
  21. package/dist/preview-client/_static/{MarkdownAsset-b42846c0.js → MarkdownAsset-b2a3fad5.js} +1 -1
  22. package/dist/preview-client/_static/{MaterialAsset-0b9d7eba.js → MaterialAsset-5353c4cb.js} +1 -1
  23. package/dist/preview-client/_static/{MaterialInspector-23ea0240.js → MaterialInspector-8d466d59.js} +1 -1
  24. package/dist/preview-client/_static/{Menu-05c1f0a4.js → Menu-c8e6194b.js} +1 -1
  25. package/dist/preview-client/_static/{MeshAsset-85e99837.js → MeshAsset-c2bf60c5.js} +1 -1
  26. package/dist/preview-client/_static/{MeshRendererBaseComponent-5621d663.js → MeshRendererBaseComponent-fde6b6a5.js} +1 -1
  27. package/dist/preview-client/_static/{MeshRendererComponent-c3c3c683.js → MeshRendererComponent-430774ef.js} +1 -1
  28. package/dist/preview-client/_static/{MeshThumbnail-b1283749.js → MeshThumbnail-07ffa076.js} +1 -1
  29. package/dist/preview-client/_static/ParticleRendererComponent-e106bd8c.js +26 -0
  30. package/dist/preview-client/_static/{PhysicsMaterialAsset-cb9afb6e.js → PhysicsMaterialAsset-a2f73b5c.js} +1 -1
  31. package/dist/preview-client/_static/{PhysicsStore-0a751fa0.js → PhysicsStore-818c2f61.js} +1 -1
  32. package/dist/preview-client/_static/{PointLight-a2bfed75.js → PointLight-add790ea.js} +1 -1
  33. package/dist/preview-client/_static/{PostProcessComponent-040cf521.js → PostProcessComponent-af270a77.js} +1 -1
  34. package/dist/preview-client/_static/{PrefabAsset-265f6f48.js → PrefabAsset-59743dbb.js} +1 -1
  35. package/dist/preview-client/_static/{PrimitiveMesh-70c93e7e.js → PrimitiveMesh-075dda8a.js} +1 -1
  36. package/dist/preview-client/_static/{ReferencedMaterial-831d0583.js → ReferencedMaterial-d11151b5.js} +1 -1
  37. package/dist/preview-client/_static/{RenderTargetAsset-b810caf3.js → RenderTargetAsset-b3cd1c49.js} +1 -1
  38. package/dist/preview-client/_static/{SceneAsset-d05b1a79.js → SceneAsset-08752701.js} +1 -1
  39. package/dist/preview-client/_static/{ShaderAsset-370b6f1c.js → ShaderAsset-a9d667f5.js} +1 -1
  40. package/dist/preview-client/_static/{ShaderChunkAsset-e3487bd1.js → ShaderChunkAsset-e43dde8a.js} +1 -1
  41. package/dist/preview-client/_static/{ShaderUIScriptAsset-ebf57ceb.js → ShaderUIScriptAsset-e1cd0b8b.js} +1 -1
  42. package/dist/preview-client/_static/{SkinnedMeshRendererComponent-ee33da25.js → SkinnedMeshRendererComponent-9756bd5f.js} +1 -1
  43. package/dist/preview-client/_static/{SpineAnimationComponent-12e694e8.js → SpineAnimationComponent-f3e0ff44.js} +1 -1
  44. package/dist/preview-client/_static/{SpineSkeletonDataAsset-0dffbb4d.js → SpineSkeletonDataAsset-43b731f1.js} +1 -1
  45. package/dist/preview-client/_static/{SpotLight-ada565f2.js → SpotLight-649b0e21.js} +1 -1
  46. package/dist/preview-client/_static/{SpriteBaseComponent-3156cb3b.js → SpriteBaseComponent-d2a7ab4c.js} +1 -1
  47. package/dist/preview-client/_static/{SpriteMaskComponent-a32024e1.js → SpriteMaskComponent-2c1cef5e.js} +1 -1
  48. package/dist/preview-client/_static/{SpriteRendererComponent-489486e0.js → SpriteRendererComponent-33b71997.js} +1 -1
  49. package/dist/preview-client/_static/{TextBaseComponent-520dea39.js → TextBaseComponent-9310e0c6.js} +1 -1
  50. package/dist/preview-client/_static/{TextRendererComponent-6be5f80c.js → TextRendererComponent-8dc0d7fb.js} +1 -1
  51. package/dist/preview-client/_static/{TextureAsset-9cd94531.js → TextureAsset-a7ff39b1.js} +1 -1
  52. package/dist/preview-client/_static/{Tooltip-71e5a4e7.js → Tooltip-b5be390f.js} +1 -1
  53. package/dist/preview-client/_static/{TrailRendererComponent-74bf88c0.js → TrailRendererComponent-c4635fab.js} +1 -1
  54. package/dist/preview-client/_static/{TransformBaseComponent-0d241199.js → TransformBaseComponent-1473deaa.js} +1 -1
  55. package/dist/preview-client/_static/{TransformComponent-49d279f5.js → TransformComponent-e544f7ac.js} +1 -1
  56. package/dist/preview-client/_static/{XRReferenceImageAsset-79e78558.js → XRReferenceImageAsset-96f516ba.js} +1 -1
  57. package/dist/preview-client/_static/{audio-5d0ddf55.js → audio-b5fbde34.js} +1 -1
  58. package/dist/preview-client/_static/{createOnModelChange-e65da908.js → createOnModelChange-370b83da.js} +1 -1
  59. package/dist/preview-client/_static/{createReactComponent-cb70ea50.js → createReactComponent-58d9f0dd.js} +1 -1
  60. package/dist/preview-client/_static/{index-7e414715.js → index-05b76766.js} +1 -1
  61. package/dist/preview-client/_static/{index-b13216a9.js → index-0dd5bb36.js} +1 -1
  62. package/dist/preview-client/_static/{index-d00c8bc3.js → index-29c59aff.js} +1 -1
  63. package/dist/preview-client/_static/index-3680d0e0.js +1 -0
  64. package/dist/preview-client/_static/index-42aa3a49.js +1 -0
  65. package/dist/preview-client/_static/index-496f331d.js +1 -0
  66. package/dist/preview-client/_static/{index-46c87b46.js → index-74bcfad9.js} +1 -1
  67. package/dist/preview-client/_static/{index-788e8750.js → index-88650db7.js} +1 -1
  68. package/dist/preview-client/_static/index-9f0122f0.js +1 -0
  69. package/dist/preview-client/_static/{index-b4bde36a.js → index-ab8556cb.js} +3 -3
  70. package/dist/preview-client/_static/{index-e44b357e.js → index-c3dec278.js} +11 -11
  71. package/dist/preview-client/_static/index-c6b7045c.js +1 -0
  72. package/dist/preview-client/_static/index-cdbb2f4d.js +1 -0
  73. package/dist/preview-client/_static/{index-ea7fe254.js → index-da16047f.js} +1 -1
  74. package/dist/preview-client/_static/{index-f7bd6fef.js → index-dd0763bf.js} +1 -1
  75. package/dist/preview-client/_static/index-dddcae01.js +1 -0
  76. package/dist/preview-client/_static/{ktx2-encoder-522fc017.js → ktx2-encoder-db93524f.js} +1 -1
  77. package/dist/preview-client/_static/{module-57b6e417.js → module-ada3dced.js} +1 -1
  78. package/dist/preview-client/_static/{module-5906e0d4.js → module-de7ee724.js} +1 -1
  79. package/dist/preview-client/_static/{module-5547be1c.js → module-ec094ef6.js} +1 -1
  80. package/dist/preview-client/_static/postmen-2853c0e6.js +2 -0
  81. package/dist/preview-client/_static/{shader-data-utils-000170ae.js → shader-data-utils-f0e4f5a3.js} +1 -1
  82. package/dist/preview-client/index.html +1 -1
  83. package/package.json +27 -32
  84. package/dist/preview-client/_static/ParticleRendererComponent-94656239.js +0 -26
  85. package/dist/preview-client/_static/index-0fef73f8.js +0 -1
  86. package/dist/preview-client/_static/index-1e036622.js +0 -1
  87. package/dist/preview-client/_static/index-1fd4207a.js +0 -1
  88. package/dist/preview-client/_static/index-6649d404.js +0 -1
  89. package/dist/preview-client/_static/index-87ef1c72.js +0 -1
  90. package/dist/preview-client/_static/index-d9ee84ce.js +0 -1
  91. package/dist/preview-client/_static/index-debbe073.js +0 -1
  92. package/dist/preview-client/_static/postmen-443b3e5f.js +0 -2
@@ -5723,11 +5723,11 @@ var require_valid = __commonJS({
5723
5723
  "../../node_modules/semver/functions/valid.js"(exports2, module2) {
5724
5724
  "use strict";
5725
5725
  var parse4 = require_parse();
5726
- var valid = (version4, options) => {
5726
+ var valid2 = (version4, options) => {
5727
5727
  const v6 = parse4(version4, options);
5728
5728
  return v6 ? v6.version : null;
5729
5729
  };
5730
- module2.exports = valid;
5730
+ module2.exports = valid2;
5731
5731
  }
5732
5732
  });
5733
5733
 
@@ -5934,8 +5934,8 @@ var require_lt = __commonJS({
5934
5934
  "../../node_modules/semver/functions/lt.js"(exports2, module2) {
5935
5935
  "use strict";
5936
5936
  var compare = require_compare();
5937
- var lt2 = (a6, b6, loose) => compare(a6, b6, loose) < 0;
5938
- module2.exports = lt2;
5937
+ var lt3 = (a6, b6, loose) => compare(a6, b6, loose) < 0;
5938
+ module2.exports = lt3;
5939
5939
  }
5940
5940
  });
5941
5941
 
@@ -5987,7 +5987,7 @@ var require_cmp = __commonJS({
5987
5987
  var neq = require_neq();
5988
5988
  var gt2 = require_gt();
5989
5989
  var gte2 = require_gte();
5990
- var lt2 = require_lt();
5990
+ var lt3 = require_lt();
5991
5991
  var lte2 = require_lte();
5992
5992
  var cmp = (a6, op, b6, loose) => {
5993
5993
  switch (op) {
@@ -6018,7 +6018,7 @@ var require_cmp = __commonJS({
6018
6018
  case ">=":
6019
6019
  return gte2(a6, b6, loose);
6020
6020
  case "<":
6021
- return lt2(a6, b6, loose);
6021
+ return lt3(a6, b6, loose);
6022
6022
  case "<=":
6023
6023
  return lte2(a6, b6, loose);
6024
6024
  default:
@@ -6771,7 +6771,7 @@ var require_outside = __commonJS({
6771
6771
  var Range4 = require_range();
6772
6772
  var satisfies = require_satisfies();
6773
6773
  var gt2 = require_gt();
6774
- var lt2 = require_lt();
6774
+ var lt3 = require_lt();
6775
6775
  var lte2 = require_lte();
6776
6776
  var gte2 = require_gte();
6777
6777
  var outside = (version4, range3, hilo, options) => {
@@ -6782,12 +6782,12 @@ var require_outside = __commonJS({
6782
6782
  case ">":
6783
6783
  gtfn = gt2;
6784
6784
  ltefn = lte2;
6785
- ltfn = lt2;
6785
+ ltfn = lt3;
6786
6786
  comp = ">";
6787
6787
  ecomp = ">=";
6788
6788
  break;
6789
6789
  case "<":
6790
- gtfn = lt2;
6790
+ gtfn = lt3;
6791
6791
  ltefn = gte2;
6792
6792
  ltfn = gt2;
6793
6793
  comp = "<";
@@ -6968,12 +6968,12 @@ var require_subset = __commonJS({
6968
6968
  }
6969
6969
  }
6970
6970
  const eqSet = /* @__PURE__ */ new Set();
6971
- let gt2, lt2;
6971
+ let gt2, lt3;
6972
6972
  for (const c6 of sub2) {
6973
6973
  if (c6.operator === ">" || c6.operator === ">=") {
6974
6974
  gt2 = higherGT(gt2, c6, options);
6975
6975
  } else if (c6.operator === "<" || c6.operator === "<=") {
6976
- lt2 = lowerLT(lt2, c6, options);
6976
+ lt3 = lowerLT(lt3, c6, options);
6977
6977
  } else {
6978
6978
  eqSet.add(c6.semver);
6979
6979
  }
@@ -6982,11 +6982,11 @@ var require_subset = __commonJS({
6982
6982
  return null;
6983
6983
  }
6984
6984
  let gtltComp;
6985
- if (gt2 && lt2) {
6986
- gtltComp = compare(gt2.semver, lt2.semver, options);
6985
+ if (gt2 && lt3) {
6986
+ gtltComp = compare(gt2.semver, lt3.semver, options);
6987
6987
  if (gtltComp > 0) {
6988
6988
  return null;
6989
- } else if (gtltComp === 0 && (gt2.operator !== ">=" || lt2.operator !== "<=")) {
6989
+ } else if (gtltComp === 0 && (gt2.operator !== ">=" || lt3.operator !== "<=")) {
6990
6990
  return null;
6991
6991
  }
6992
6992
  }
@@ -6994,7 +6994,7 @@ var require_subset = __commonJS({
6994
6994
  if (gt2 && !satisfies(eq4, String(gt2), options)) {
6995
6995
  return null;
6996
6996
  }
6997
- if (lt2 && !satisfies(eq4, String(lt2), options)) {
6997
+ if (lt3 && !satisfies(eq4, String(lt3), options)) {
6998
6998
  return null;
6999
6999
  }
7000
7000
  for (const c6 of dom) {
@@ -7006,9 +7006,9 @@ var require_subset = __commonJS({
7006
7006
  }
7007
7007
  let higher, lower;
7008
7008
  let hasDomLT, hasDomGT;
7009
- let needDomLTPre = lt2 && !options.includePrerelease && lt2.semver.prerelease.length ? lt2.semver : false;
7009
+ let needDomLTPre = lt3 && !options.includePrerelease && lt3.semver.prerelease.length ? lt3.semver : false;
7010
7010
  let needDomGTPre = gt2 && !options.includePrerelease && gt2.semver.prerelease.length ? gt2.semver : false;
7011
- if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt2.operator === "<" && needDomLTPre.prerelease[0] === 0) {
7011
+ if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt3.operator === "<" && needDomLTPre.prerelease[0] === 0) {
7012
7012
  needDomLTPre = false;
7013
7013
  }
7014
7014
  for (const c6 of dom) {
@@ -7029,29 +7029,29 @@ var require_subset = __commonJS({
7029
7029
  return false;
7030
7030
  }
7031
7031
  }
7032
- if (lt2) {
7032
+ if (lt3) {
7033
7033
  if (needDomLTPre) {
7034
7034
  if (c6.semver.prerelease && c6.semver.prerelease.length && c6.semver.major === needDomLTPre.major && c6.semver.minor === needDomLTPre.minor && c6.semver.patch === needDomLTPre.patch) {
7035
7035
  needDomLTPre = false;
7036
7036
  }
7037
7037
  }
7038
7038
  if (c6.operator === "<" || c6.operator === "<=") {
7039
- lower = lowerLT(lt2, c6, options);
7040
- if (lower === c6 && lower !== lt2) {
7039
+ lower = lowerLT(lt3, c6, options);
7040
+ if (lower === c6 && lower !== lt3) {
7041
7041
  return false;
7042
7042
  }
7043
- } else if (lt2.operator === "<=" && !satisfies(lt2.semver, String(c6), options)) {
7043
+ } else if (lt3.operator === "<=" && !satisfies(lt3.semver, String(c6), options)) {
7044
7044
  return false;
7045
7045
  }
7046
7046
  }
7047
- if (!c6.operator && (lt2 || gt2) && gtltComp !== 0) {
7047
+ if (!c6.operator && (lt3 || gt2) && gtltComp !== 0) {
7048
7048
  return false;
7049
7049
  }
7050
7050
  }
7051
- if (gt2 && hasDomLT && !lt2 && gtltComp !== 0) {
7051
+ if (gt2 && hasDomLT && !lt3 && gtltComp !== 0) {
7052
7052
  return false;
7053
7053
  }
7054
- if (lt2 && hasDomGT && !gt2 && gtltComp !== 0) {
7054
+ if (lt3 && hasDomGT && !gt2 && gtltComp !== 0) {
7055
7055
  return false;
7056
7056
  }
7057
7057
  if (needDomGTPre || needDomLTPre) {
@@ -7086,7 +7086,7 @@ var require_semver2 = __commonJS({
7086
7086
  var SemVer = require_semver();
7087
7087
  var identifiers = require_identifiers();
7088
7088
  var parse4 = require_parse();
7089
- var valid = require_valid();
7089
+ var valid2 = require_valid();
7090
7090
  var clean2 = require_clean();
7091
7091
  var inc = require_inc();
7092
7092
  var diff = require_diff();
@@ -7101,7 +7101,7 @@ var require_semver2 = __commonJS({
7101
7101
  var sort = require_sort();
7102
7102
  var rsort = require_rsort();
7103
7103
  var gt2 = require_gt();
7104
- var lt2 = require_lt();
7104
+ var lt3 = require_lt();
7105
7105
  var eq4 = require_eq();
7106
7106
  var neq = require_neq();
7107
7107
  var gte2 = require_gte();
@@ -7124,7 +7124,7 @@ var require_semver2 = __commonJS({
7124
7124
  var subset = require_subset();
7125
7125
  module2.exports = {
7126
7126
  parse: parse4,
7127
- valid,
7127
+ valid: valid2,
7128
7128
  clean: clean2,
7129
7129
  inc,
7130
7130
  diff,
@@ -7139,7 +7139,7 @@ var require_semver2 = __commonJS({
7139
7139
  sort,
7140
7140
  rsort,
7141
7141
  gt: gt2,
7142
- lt: lt2,
7142
+ lt: lt3,
7143
7143
  eq: eq4,
7144
7144
  neq,
7145
7145
  gte: gte2,
@@ -7173,6 +7173,19 @@ var require_semver2 = __commonJS({
7173
7173
  });
7174
7174
 
7175
7175
  // ../constants/src/builder.ts
7176
+ function getEnginePrereleaseTag(engineVersion) {
7177
+ if (engineVersion.includes("alpha"))
7178
+ return "alpha";
7179
+ if (engineVersion.includes("beta"))
7180
+ return "beta";
7181
+ return void 0;
7182
+ }
7183
+ function resolveShaderCompilerDependencyVersion(engineVersion) {
7184
+ if (getEnginePrereleaseTag(engineVersion) === "alpha" && (0, import_semver.valid)(engineVersion) && (0, import_semver.lt)(engineVersion, "2.0.0-alpha.31")) {
7185
+ return "alpha";
7186
+ }
7187
+ return engineVersion;
7188
+ }
7176
7189
  function shouldEnableShaderCompiler(engineVersion) {
7177
7190
  return (0, import_semver.major)(engineVersion) >= 2;
7178
7191
  }
@@ -7223,7 +7236,7 @@ function resolveFeatureDependencies(features, engineVersion, projectDependencies
7223
7236
  deps["@galacean/engine-spine"] = compatibleVersion;
7224
7237
  }
7225
7238
  if (features["shaderCompiler" /* ShaderCompiler */]) {
7226
- deps["@galacean/engine-shader-compiler"] = engineVersion;
7239
+ deps["@galacean/engine-shader-compiler"] = resolveShaderCompilerDependencyVersion(engineVersion);
7227
7240
  deps["@galacean/engine-shader"] = engineVersion;
7228
7241
  }
7229
7242
  if (features["physicsLite" /* PhysicsLite */]) {
@@ -7342,7 +7355,7 @@ function getBuiltinAssetSourceVirtualPath(assetId) {
7342
7355
  BUILTIN_SOURCE_VIRTUAL_PATH_CACHE.set(assetId, virtualPath);
7343
7356
  return virtualPath;
7344
7357
  }
7345
- var BUILTIN_FOLDER_ASSETS, BUILTIN_REMOTE_ASSETS, BUILTIN_REMOTE_ASSET_BY_ID, BUILTIN_SOURCE_VIRTUAL_PATH_CACHE;
7358
+ var BUILTIN_FOLDER_ASSETS, BUILTIN_REMOTE_ASSETS, BUILTIN_REMOTE_ASSET_BY_ID, BUILTIN_SOURCE_VIRTUAL_PATH_CACHE, BUILTIN_REMOTE_ASSET_UUIDS;
7346
7359
  var init_builtin_assets = __esm({
7347
7360
  "../constants/src/builtin-assets.ts"() {
7348
7361
  "use strict";
@@ -7684,6 +7697,7 @@ var init_builtin_assets = __esm({
7684
7697
  ];
7685
7698
  BUILTIN_REMOTE_ASSET_BY_ID = new Map(BUILTIN_REMOTE_ASSETS.map((asset3) => [asset3.uuid, asset3]));
7686
7699
  BUILTIN_SOURCE_VIRTUAL_PATH_CACHE = /* @__PURE__ */ new Map();
7700
+ BUILTIN_REMOTE_ASSET_UUIDS = new Set(BUILTIN_REMOTE_ASSETS.map((a6) => a6.uuid));
7687
7701
  }
7688
7702
  });
7689
7703
 
@@ -7896,12 +7910,6 @@ function isFileNotFoundError(err2) {
7896
7910
  return true;
7897
7911
  return typeof record2.message === "string" && /file not found|no such file/i.test(record2.message);
7898
7912
  }
7899
- function isAbortError(err2) {
7900
- if (!err2 || typeof err2 !== "object")
7901
- return false;
7902
- const e6 = err2;
7903
- return e6.name === "AbortError";
7904
- }
7905
7913
  function throwIfAborted2(signal) {
7906
7914
  if (signal?.aborted) {
7907
7915
  const error49 = new Error("The operation was aborted");
@@ -8203,6 +8211,26 @@ function isSceneUploadPath(assetPath) {
8203
8211
  function sortSceneUploadsLast(items, isScene) {
8204
8212
  return items.map((item, index2) => ({ item, index: index2, scene: isScene(item) })).sort((a6, b6) => Number(a6.scene) - Number(b6.scene) || a6.index - b6.index).map(({ item }) => item);
8205
8213
  }
8214
+ async function uploadSceneSeals(opts) {
8215
+ const { apiClient, fs: fs5, projectDir, scenes, pushed, signal } = opts;
8216
+ for (const [assetId, entry] of scenes) {
8217
+ throwIfAborted2(signal);
8218
+ if (!entry.serverId || entry.serverId.startsWith("local-"))
8219
+ continue;
8220
+ const filePath = import_node_path6.default.resolve(projectDir, entry.path);
8221
+ const content = await fs5.readFile(filePath);
8222
+ const currentHash = md52(content);
8223
+ const upload = await apiClient.uploadAsset(entry.serverId, content, getServerFileName(entry.path, entry.type), {
8224
+ signal
8225
+ });
8226
+ entry.contentHash = currentHash;
8227
+ entry.url = upload.url;
8228
+ const pushedEntry = pushed.find((item) => item.assetId === assetId);
8229
+ if (pushedEntry) {
8230
+ pushedEntry.url = upload.url;
8231
+ }
8232
+ }
8233
+ }
8206
8234
  async function pushProject(opts) {
8207
8235
  const { projectDir, apiClient, fs: fs5, signal } = opts;
8208
8236
  const pruneRemote = opts.pruneRemote !== false;
@@ -8214,12 +8242,13 @@ async function pushProject(opts) {
8214
8242
  const deleted = [];
8215
8243
  const warnings = [];
8216
8244
  const warnedInternalUserAssets = /* @__PURE__ */ new Set();
8217
- const warnInternalUserAssetSkip = (assetId, assetPath) => {
8245
+ let remoteAssetMetadataChanged = false;
8246
+ const warnInternalUserAssetSkip = (assetId, assetPath, operation = "remote sync") => {
8218
8247
  if (!isBuiltinAssetPath(assetPath) || isBuiltinAssetId(assetId) || warnedInternalUserAssets.has(assetId))
8219
8248
  return;
8220
8249
  warnedInternalUserAssets.add(assetId);
8221
8250
  warnings.push(
8222
- `Skipped remote sync for non-builtin asset under assets/Internal/: ${assetPath}. Path-only builtin protection treats this path as internal.`
8251
+ `Skipped ${operation} for non-builtin asset under assets/Internal/: ${assetPath}. Path-only builtin protection treats this path as internal.`
8223
8252
  );
8224
8253
  };
8225
8254
  let primaryError;
@@ -8564,10 +8593,6 @@ async function pushProject(opts) {
8564
8593
  continue;
8565
8594
  if (locallyDeletedIds.has(assetId))
8566
8595
  continue;
8567
- if (isBuiltinAssetPath(entry.path)) {
8568
- warnInternalUserAssetSkip(assetId, entry.path);
8569
- continue;
8570
- }
8571
8596
  const filePath = import_node_path6.default.resolve(projectDir, entry.path);
8572
8597
  let content;
8573
8598
  try {
@@ -8582,6 +8607,10 @@ async function pushProject(opts) {
8582
8607
  const isLocalOnly = !entry.serverId || entry.serverId.startsWith("local-");
8583
8608
  if (!isLocalOnly && currentHash === entry.contentHash)
8584
8609
  continue;
8610
+ if (isBuiltinAssetPath(entry.path)) {
8611
+ warnInternalUserAssetSkip(assetId, entry.path, "remote content upload");
8612
+ continue;
8613
+ }
8585
8614
  const serverName = getServerFileName(entry.path, entry.type);
8586
8615
  if (isLocalOnly) {
8587
8616
  const existingId = existingServerAssets.get(assetId);
@@ -8629,10 +8658,6 @@ async function pushProject(opts) {
8629
8658
  const localEntry = manifest.entries[serverAsset.uuid];
8630
8659
  if (!localEntry?.serverId || localEntry.serverId.startsWith("local-"))
8631
8660
  continue;
8632
- if (localEntry && isBuiltinAssetPath(localEntry.path)) {
8633
- warnInternalUserAssetSkip(serverAsset.uuid, localEntry.path);
8634
- continue;
8635
- }
8636
8661
  const localName = getServerFileName(localEntry.path, localEntry.type);
8637
8662
  const localParentId = folderIdByPath.get(import_node_path6.default.posix.dirname(localEntry.path));
8638
8663
  const nameChanged = serverAsset.name !== localName;
@@ -8640,20 +8665,17 @@ async function pushProject(opts) {
8640
8665
  const effectiveLocalParentId = localParentId || void 0;
8641
8666
  const parentChanged = serverParentId !== effectiveLocalParentId;
8642
8667
  if (nameChanged || parentChanged) {
8643
- try {
8644
- const params = { serverId: localEntry.serverId };
8645
- if (nameChanged)
8646
- params.name = localName;
8647
- if (parentChanged)
8648
- params.parentId = localParentId;
8649
- await apiClient.updateAssetMeta(params, { signal });
8650
- } catch (err2) {
8651
- if (isAbortError(err2))
8652
- throw err2;
8653
- warnings.push(
8654
- `Failed to rename/move asset '${localEntry.path}': ${err2 instanceof Error ? err2.message : String(err2)}`
8655
- );
8668
+ if (isBuiltinAssetPath(localEntry.path)) {
8669
+ warnInternalUserAssetSkip(serverAsset.uuid, localEntry.path, "remote rename/move sync");
8670
+ continue;
8656
8671
  }
8672
+ const params = { serverId: localEntry.serverId };
8673
+ if (nameChanged)
8674
+ params.name = localName;
8675
+ if (parentChanged)
8676
+ params.parentId = localParentId;
8677
+ await apiClient.updateAssetMeta(params, { signal });
8678
+ remoteAssetMetadataChanged = true;
8657
8679
  }
8658
8680
  }
8659
8681
  if (remote) {
@@ -8688,6 +8710,17 @@ async function pushProject(opts) {
8688
8710
  delete manifest.entries[assetId];
8689
8711
  }
8690
8712
  }
8713
+ if (remoteAssetMetadataChanged) {
8714
+ const sceneSealCandidates = /* @__PURE__ */ new Map();
8715
+ for (const { assetId } of pushed) {
8716
+ const entry = manifest.entries[assetId];
8717
+ if (entry && isSceneUploadEntry(entry))
8718
+ sceneSealCandidates.set(assetId, entry);
8719
+ }
8720
+ if (sceneSealCandidates.size > 0) {
8721
+ await uploadSceneSeals({ apiClient, fs: fs5, projectDir, scenes: sceneSealCandidates, pushed, signal });
8722
+ }
8723
+ }
8691
8724
  if (remote) {
8692
8725
  await syncProjectMetadata(apiClient, remote.projectId, manifest, projectConfig, project2, signal);
8693
8726
  }
@@ -8740,7 +8773,7 @@ async function syncProjectMetadata(apiClient, projectId, manifest, projectConfig
8740
8773
  await apiClient.updateProjectSchema(projectId, { scene: resolvedSceneId }, { signal });
8741
8774
  }
8742
8775
  }
8743
- var import_node_crypto3, import_node_path6, BUILTIN_REMOTE_ASSET_UUIDS, AUTOCREATE_BUILTIN_BOOTSTRAP_PENDING_PATH;
8776
+ var import_node_crypto3, import_node_path6, AUTOCREATE_BUILTIN_BOOTSTRAP_PENDING_PATH;
8744
8777
  var init_push = __esm({
8745
8778
  "src/commands/push.ts"() {
8746
8779
  "use strict";
@@ -8750,7 +8783,6 @@ var init_push = __esm({
8750
8783
  init_ignore_rules();
8751
8784
  init_asset_path();
8752
8785
  init_meta_file();
8753
- BUILTIN_REMOTE_ASSET_UUIDS = new Set(BUILTIN_REMOTE_ASSETS.map((asset3) => asset3.uuid));
8754
8786
  AUTOCREATE_BUILTIN_BOOTSTRAP_PENDING_PATH = ".galacean/autocreate-builtin-bootstrap-pending.json";
8755
8787
  }
8756
8788
  });
@@ -12569,7 +12601,7 @@ var require_mobx_cjs_production_min = __commonJS({
12569
12601
  jt(n8[i7], t9);
12570
12602
  t9.C = di.I;
12571
12603
  }
12572
- function lt2(t9) {
12604
+ function lt3(t9) {
12573
12605
  var n8 = dt();
12574
12606
  try {
12575
12607
  return t9();
@@ -13751,7 +13783,7 @@ var require_mobx_cjs_production_min = __commonJS({
13751
13783
  }, i7.clear = function() {
13752
13784
  var t9 = this;
13753
13785
  Jt(function() {
13754
- lt2(function() {
13786
+ lt3(function() {
13755
13787
  for (var n9, i8 = O3(t9.keys()); !(n9 = i8()).done; )
13756
13788
  t9.delete(n9.value);
13757
13789
  });
@@ -13832,7 +13864,7 @@ var require_mobx_cjs_production_min = __commonJS({
13832
13864
  }, i7.clear = function() {
13833
13865
  var t9 = this;
13834
13866
  Jt(function() {
13835
- lt2(function() {
13867
+ lt3(function() {
13836
13868
  for (var n9, i8 = O3(t9.lt.values()); !(n9 = i8()).done; )
13837
13869
  t9.delete(n9.value);
13838
13870
  });
@@ -14299,7 +14331,7 @@ var require_mobx_cjs_production_min = __commonJS({
14299
14331
  }), o7;
14300
14332
  }(t9, /* @__PURE__ */ new Map());
14301
14333
  }, exports2.trace = function() {
14302
- }, exports2.transaction = Jt, exports2.untracked = lt2, exports2.values = function(n8) {
14334
+ }, exports2.transaction = Jt, exports2.untracked = lt3, exports2.values = function(n8) {
14303
14335
  return bn(n8) ? Xt(n8).map(function(t9) {
14304
14336
  return n8[t9];
14305
14337
  }) : $i(n8) ? Xt(n8).map(function(t9) {
@@ -41855,11 +41887,53 @@ function findBindingForSerializableInstance(state, entity) {
41855
41887
  }
41856
41888
  function domainStateToSceneFileV2(state, optionsOrResolveAssetRef = {}) {
41857
41889
  const resolveRef3 = createAssetRefResolver(optionsOrResolveAssetRef);
41858
- const sceneSettings = state.scene.settings ? editorSceneSettingsToSourceSettings(state.scene.settings, resolveRef3) : void 0;
41890
+ let sceneSettings;
41891
+ if (state.scene.settings) {
41892
+ try {
41893
+ sceneSettings = editorSceneSettingsToSourceSettings(
41894
+ state.scene.settings,
41895
+ resolveRef3
41896
+ );
41897
+ } catch (err2) {
41898
+ if (err2 instanceof SceneV2DanglingAssetRefError) {
41899
+ console.warn(`[SceneV2] scene settings dangling ref, settings \u6574\u4F53\u8DF3\u8FC7: ${err2.message}`);
41900
+ sceneSettings = void 0;
41901
+ } else {
41902
+ throw err2;
41903
+ }
41904
+ }
41905
+ }
41859
41906
  const ordered = orderSceneEntities(state);
41860
- const entityIds = ordered.map((entity) => entity.id);
41861
41907
  const components = [];
41908
+ const candidateEntityIds = ordered.map((entity) => entity.id);
41862
41909
  const entities = ordered.map((entity) => {
41910
+ const entityComponentsBuffer = [];
41911
+ try {
41912
+ const result3 = serializeOneEntity(entity, entityComponentsBuffer, candidateEntityIds);
41913
+ components.push(...entityComponentsBuffer);
41914
+ return result3;
41915
+ } catch (err2) {
41916
+ if (err2 instanceof SceneV2DanglingAssetRefError) {
41917
+ console.warn(`[SceneV2] skip entity "${entity.id}" (name="${entity.name}") from save: ${err2.message}`);
41918
+ return null;
41919
+ }
41920
+ throw err2;
41921
+ }
41922
+ }).filter((e6) => e6 !== null);
41923
+ const validEntityIds = new Set(entities.map((e6) => e6.id));
41924
+ for (const entity of entities) {
41925
+ if (!entity.children)
41926
+ continue;
41927
+ const pruned = entity.children.filter((id) => validEntityIds.has(id));
41928
+ if (pruned.length !== entity.children.length) {
41929
+ if (pruned.length) {
41930
+ entity.children = pruned;
41931
+ } else {
41932
+ delete entity.children;
41933
+ }
41934
+ }
41935
+ }
41936
+ function serializeOneEntity(entity, componentsBuffer, candidateIds) {
41863
41937
  const entityBinding = findBindingForSerializableInstance(state, entity);
41864
41938
  const bindingOverrides = entity.instance?.assetId && entity.instance.role !== "added" ? prefabBindingsToV2OverridesForEntity(state, entityBinding, resolveRef3) : void 0;
41865
41939
  const rootOverrideTarget = resolveSerializableInstanceRootOverrideTarget(entity, entityBinding);
@@ -41905,7 +41979,7 @@ function domainStateToSceneFileV2(state, optionsOrResolveAssetRef = {}) {
41905
41979
  instanceResult.instance.overrides = inlineOverrides;
41906
41980
  return instanceResult;
41907
41981
  }
41908
- const childIds = entity.children.filter((id) => entityIds.includes(id));
41982
+ const childIds = entity.children.filter((id) => candidateIds.includes(id));
41909
41983
  if (childIds.length)
41910
41984
  result3.children = childIds;
41911
41985
  const componentEntries = Object.entries(entity.components);
@@ -41916,13 +41990,13 @@ function domainStateToSceneFileV2(state, optionsOrResolveAssetRef = {}) {
41916
41990
  if (component2.instance?.role === "added")
41917
41991
  continue;
41918
41992
  sourceComponentIds3.push(componentId);
41919
- components.push(componentStateToSourceComponent(componentId, component2, resolveRef3));
41993
+ componentsBuffer.push(componentStateToSourceComponent(componentId, component2, resolveRef3));
41920
41994
  }
41921
41995
  if (sourceComponentIds3.length)
41922
41996
  result3.components = sourceComponentIds3;
41923
41997
  return result3;
41924
- });
41925
- const rootEntityIds = state.scene.rootEntityIds.filter((id) => entityIds.includes(id));
41998
+ }
41999
+ const rootEntityIds = state.scene.rootEntityIds.filter((id) => validEntityIds.has(id));
41926
42000
  const result2 = {
41927
42001
  asset: { version: "2.0", generator: "Galacean Editor" },
41928
42002
  scene: {
@@ -42017,7 +42091,7 @@ function createAssetRefResolver(optionsOrResolveAssetRef) {
42017
42091
  return (assetId) => {
42018
42092
  const sourceRef = resolveAssetRef2?.(assetId);
42019
42093
  if (typeof sourceRef !== "string" || sourceRef.length === 0) {
42020
- throw new Error(`[SceneV2] Unable to serialize asset ref "${assetId}": missing virtualPath`);
42094
+ throw new SceneV2DanglingAssetRefError(assetId);
42021
42095
  }
42022
42096
  return sourceRef;
42023
42097
  };
@@ -42156,6 +42230,7 @@ function orderSceneEntities(state) {
42156
42230
  }
42157
42231
  return ordered;
42158
42232
  }
42233
+ var SCENE_V2_DANGLING_REF_SENTINEL, SceneV2DanglingAssetRefError;
42159
42234
  var init_domain_codec = __esm({
42160
42235
  "../model/src/scene-file-v2/domain-codec.ts"() {
42161
42236
  "use strict";
@@ -42169,6 +42244,14 @@ var init_domain_codec = __esm({
42169
42244
  init_source_value();
42170
42245
  init_prefab_overrides();
42171
42246
  init_prefab_override_utils();
42247
+ SCENE_V2_DANGLING_REF_SENTINEL = Symbol("SceneV2DanglingAssetRef");
42248
+ SceneV2DanglingAssetRefError = class extends Error {
42249
+ constructor(assetId) {
42250
+ super(`[SceneV2] dangling asset ref "${assetId}" \u2014 entity/binding skipped from save`);
42251
+ this.assetId = assetId;
42252
+ this.name = "SceneV2DanglingAssetRefError";
42253
+ }
42254
+ };
42172
42255
  }
42173
42256
  });
42174
42257
 
@@ -125404,7 +125487,8 @@ function createDomainAssetSourceRefResolver(assets2) {
125404
125487
  cache.set(assetId, void 0);
125405
125488
  return void 0;
125406
125489
  }
125407
- const virtualPath = parentPath ? `${parentPath}/${asset3.name}` : asset3.name;
125490
+ const assetName = asset3.type === "Folder" ? asset3.name : assetNameFromPath(asset3.name, asset3.type);
125491
+ const virtualPath = parentPath ? `${parentPath}/${assetName}` : assetName;
125408
125492
  cache.set(assetId, virtualPath);
125409
125493
  return virtualPath;
125410
125494
  };
@@ -141210,7 +141294,6 @@ __export(constants_exports, {
141210
141294
  SKILL_TOOL_NAMES: () => SKILL_TOOL_NAMES,
141211
141295
  isAssetTool: () => isAssetTool,
141212
141296
  isClientSideTool: () => isClientSideTool,
141213
- isServerSideTool: () => isServerSideTool,
141214
141297
  isSkillTool: () => isSkillTool,
141215
141298
  suggestToolName: () => suggestToolName
141216
141299
  });
@@ -141229,15 +141312,6 @@ function isAssetTool(name16) {
141229
141312
  return false;
141230
141313
  return ASSET_TOOL_NAMES.has(name16);
141231
141314
  }
141232
- function isServerSideTool(name16) {
141233
- if (!name16)
141234
- return false;
141235
- if (SERVER_SIDE_TOOLS.has(name16))
141236
- return true;
141237
- if (name16.startsWith("workflow-"))
141238
- return true;
141239
- return false;
141240
- }
141241
141315
  function suggestToolName(toolId, allToolIds) {
141242
141316
  const [domain2, action39] = toolId.split(".");
141243
141317
  const domainMatches = allToolIds.filter((id) => {
@@ -141262,7 +141336,7 @@ function suggestToolName(toolId, allToolIds) {
141262
141336
  }
141263
141337
  return void 0;
141264
141338
  }
141265
- var SEARCH_TOOL_NAME, EXECUTE_TOOL_NAME, MODEL_GENERATE_FROM_IMAGE_TOOL_NAME, CLIENT_SIDE_TOOLS, SKILL_TOOL_NAMES, ASSET_TOOL_NAMES, SERVER_SIDE_TOOLS;
141339
+ var SEARCH_TOOL_NAME, EXECUTE_TOOL_NAME, MODEL_GENERATE_FROM_IMAGE_TOOL_NAME, CLIENT_SIDE_TOOLS, SKILL_TOOL_NAMES, ASSET_TOOL_NAMES;
141266
141340
  var init_constants = __esm({
141267
141341
  "../ai/src/tool-runner/constants.ts"() {
141268
141342
  "use strict";
@@ -141283,41 +141357,6 @@ var init_constants = __esm({
141283
141357
  "sceneEditTool"
141284
141358
  ]);
141285
141359
  ASSET_TOOL_NAMES = /* @__PURE__ */ new Set(["sandbox_findFiles", "sandbox_cat"]);
141286
- SERVER_SIDE_TOOLS = /* @__PURE__ */ new Set([
141287
- // Mastra 内置工具
141288
- "list_skills",
141289
- "read_file",
141290
- "list_files",
141291
- "grep_files",
141292
- "glob_files",
141293
- "skill",
141294
- "skill_read",
141295
- // 编辑器服务端工具
141296
- "operationQueue",
141297
- "todo_write",
141298
- "verify",
141299
- "runtime_probe",
141300
- "particleTool",
141301
- "generate-particle-effect",
141302
- "validate_config",
141303
- "editorRouterAgent",
141304
- "sceneEditTool",
141305
- // 服务端场景编辑工具(直接修改 scene.json)
141306
- // 沙箱工具
141307
- "exec",
141308
- "search",
141309
- "upload",
141310
- "upload_batch",
141311
- "read",
141312
- "write",
141313
- "edit",
141314
- "grep",
141315
- // 旧沙箱工具名,兼容历史消息与灰度后端
141316
- "sandbox_findFiles",
141317
- "sandbox_cat",
141318
- "sandbox_writeFile",
141319
- "sandbox_getPublicUrl"
141320
- ]);
141321
141360
  }
141322
141361
  });
141323
141362
 
@@ -141341,6 +141380,7 @@ var init_errors3 = __esm({
141341
141380
  ENTITY_NOT_INITIALIZED: "\u5B9E\u4F53\u5F15\u64CE\u5BF9\u8C61\u672A\u521D\u59CB\u5316",
141342
141381
  COMPONENT_NOT_FOUND: "\u7EC4\u4EF6\u4E0D\u5B58\u5728",
141343
141382
  ASSET_NOT_FOUND: "\u8D44\u4EA7\u4E0D\u5B58\u5728",
141383
+ ASSET_ALREADY_EXISTS: "\u8D44\u4EA7\u5DF2\u5B58\u5728",
141344
141384
  FOLDER_NOT_FOUND: "\u6587\u4EF6\u5939\u4E0D\u5B58\u5728",
141345
141385
  NOT_SUPPORTED: "\u4E0D\u652F\u6301\u7684\u64CD\u4F5C",
141346
141386
  OPERATION_FAILED: "\u64CD\u4F5C\u5931\u8D25",
@@ -141469,10 +141509,13 @@ var init_common = __esm({
141469
141509
  layerMaskSchema = external_exports.union([
141470
141510
  external_exports.literal("Everything"),
141471
141511
  external_exports.literal("Nothing"),
141512
+ // 单 Layer 字符串(如 "Layer1")— 容忍 LLM 直觉传 string,handler 自动包装成数组语义
141513
+ external_exports.enum(layerNames),
141514
+ // 多 Layer 数组
141472
141515
  external_exports.array(external_exports.enum(layerNames)),
141473
- external_exports.number().int().min(0).describe("\u5F15\u64CE\u4F4D\u503C(\u9AD8\u7EA7\u7528\u6CD5,LLM \u901A\u5E38\u7528\u4E0A\u9762 3 \u79CD\u5F62\u5F0F)")
141516
+ external_exports.number().int().min(0).describe("\u5F15\u64CE\u4F4D\u503C(\u9AD8\u7EA7\u7528\u6CD5,LLM \u901A\u5E38\u7528\u4E0A\u9762\u51E0\u79CD\u5F62\u5F0F)")
141474
141517
  ]).describe(
141475
- `Layer \u63A9\u7801\u3002\u53EF\u4EE5\u4F20 'Everything'(\u6240\u6709 Layer) / 'Nothing'(\u65E0) / ["Layer0","Layer3"](\u6307\u5B9A Layer \u6570\u7EC4) / \u6570\u5B57\u4F4D\u503C`
141518
+ "Layer \u63A9\u7801\u3002\u53EF\u4EE5\u4F20:'Everything'(\u6240\u6709 Layer) / 'Nothing'(\u65E0) / \u5355 Layer \u5B57\u7B26\u4E32\u5982 'Layer1' / \u591A Layer \u6570\u7EC4\u5982 ['Layer0','Layer3'] / \u6570\u5B57\u4F4D\u503C\u3002"
141476
141519
  );
141477
141520
  assetInfoSchema = external_exports.object({
141478
141521
  path: external_exports.string().nullable().describe("\u8D44\u4EA7 vfs \u7EDD\u5BF9\u8DEF\u5F84\uFF0C\u53EF\u76F4\u63A5\u7528\u4F5C\u4E0B\u4E00\u6B65 API \u8C03\u7528\u7684\u8F93\u5165\uFF1B\u4E0D\u5728 vfs \u65F6\u4E3A null"),
@@ -141567,6 +141610,155 @@ var init_create = __esm({
141567
141610
  }
141568
141611
  });
141569
141612
 
141613
+ // ../editor-api/src/tools/asset/helpers.ts
141614
+ async function resolveAssetSnapshot(assetId, ctx, options) {
141615
+ const { assetStore } = ctx;
141616
+ const asset3 = assetStore.getAsset(assetId);
141617
+ if (!asset3) {
141618
+ throw new EditorAPIError("ASSET_NOT_FOUND", assetId);
141619
+ }
141620
+ const metaConfig = asset3.getMetaConfig();
141621
+ let props = {};
141622
+ if (typeof asset3.getMainData === "function") {
141623
+ try {
141624
+ const mainData = asset3.getMainData();
141625
+ const assetType = metaConfig.type;
141626
+ if (assetType === "script") {
141627
+ if (typeof mainData === "string") {
141628
+ props.code = mainData;
141629
+ }
141630
+ } else if (typeof mainData === "string") {
141631
+ props = JSON.parse(mainData);
141632
+ } else if (mainData && typeof mainData === "object") {
141633
+ props = JSON.parse(JSON.stringify(mainData));
141634
+ }
141635
+ } catch {
141636
+ }
141637
+ }
141638
+ if (options?.fallbackProps && Object.keys(options.fallbackProps).length > 0) {
141639
+ props = { ...props, ...options.fallbackProps };
141640
+ }
141641
+ return {
141642
+ path: getAssetPath(asset3.id, ctx),
141643
+ name: asset3.name,
141644
+ type: metaConfig.type,
141645
+ props
141646
+ };
141647
+ }
141648
+ function getAssetPath(assetId, ctx) {
141649
+ if (!assetId)
141650
+ return null;
141651
+ const vfs = ctx.vfs;
141652
+ const file2 = vfs?.getFileById?.(assetId);
141653
+ return file2?.path ?? null;
141654
+ }
141655
+ function assertAssetNameAvailable(name16, parentFolderId, assetType, ctx) {
141656
+ const children = ctx.query?.listChildren?.(parentFolderId);
141657
+ if (children !== void 0) {
141658
+ for (const child of children) {
141659
+ if (child.name === name16) {
141660
+ throwAssetAlreadyExists(assetType, name16);
141661
+ }
141662
+ }
141663
+ return;
141664
+ }
141665
+ const assets2 = ctx.rootStore?.domainStore?.state?.assets;
141666
+ if (!assets2)
141667
+ return;
141668
+ const parentKey = parentFolderId ?? null;
141669
+ for (const asset3 of Object.values(assets2)) {
141670
+ if ((asset3.parentFolderId ?? null) === parentKey && asset3.name === name16) {
141671
+ throwAssetAlreadyExists(assetType, name16);
141672
+ }
141673
+ }
141674
+ }
141675
+ function throwAssetAlreadyExists(assetType, name16) {
141676
+ throw new EditorAPIError(
141677
+ "ASSET_ALREADY_EXISTS",
141678
+ `${assetType} "${name16}" \u5DF2\u5B58\u5728\u4E8E\u6B64 folder\u3002\u5982\u8981\u590D\u7528,\u76F4\u63A5\u5F15\u7528\u73B0\u6709\u8D44\u4EA7(\u5982 scene.setActive / asset.read);\u5982\u8981\u91CD\u5EFA,\u5148\u8C03 asset.delete \u5220\u9664\u5DF2\u6709\u518D\u521B\u5EFA;\u5982\u8981\u5E76\u5B58,\u8BF7\u7528\u4E0D\u540C name(\u672C\u5DE5\u5177\u4E0D\u4F1A auto-rename,\u907F\u514D LLM \u5FC3\u667A\u8DDF vfs \u72B6\u6001\u8131\u8282)\u3002`
141679
+ );
141680
+ }
141681
+ function resolveAssetRef(ref, ctx, paramName = "ref") {
141682
+ if (typeof ref !== "string") {
141683
+ throw new EditorAPIError("INVALID_PARAMETER", `${paramName} \u5FC5\u987B\u662F\u5B57\u7B26\u4E32`);
141684
+ }
141685
+ if (!ref) {
141686
+ throw new EditorAPIError("INVALID_PARAMETER", `${paramName} \u4E0D\u80FD\u4E3A\u7A7A`);
141687
+ }
141688
+ if (!ref.startsWith("/")) {
141689
+ throw new EditorAPIError(
141690
+ "INVALID_PARAMETER",
141691
+ `${paramName} \u5FC5\u987B\u662F vfs \u7EDD\u5BF9\u8DEF\u5F84\uFF08\u4EE5 / \u5F00\u5934\uFF0C\u4E14**\u5FC5\u5E26 extname**\uFF09\uFF0C\u4F8B\u5982 "/Materials/ground.mat"\u3002\u6536\u5230: "${ref}"`
141692
+ );
141693
+ }
141694
+ const vfs = ctx.vfs;
141695
+ const file2 = vfs.getFileByPath?.(ref);
141696
+ if (!file2) {
141697
+ throw new EditorAPIError("ASSET_NOT_FOUND", `${paramName}: ${ref}`);
141698
+ }
141699
+ return file2.id;
141700
+ }
141701
+ function validateFolderIdParam(folderId, ctx) {
141702
+ if (folderId === void 0)
141703
+ return void 0;
141704
+ if (folderId === "") {
141705
+ throw new EditorAPIError(
141706
+ "INVALID_PARAMETER",
141707
+ "folder \u4E0D\u80FD\u662F\u7A7A\u5B57\u7B26\u4E32\u3002\u5982\u9700\u521B\u5EFA\u5728\u6839\u76EE\u5F55,\u8BF7\u7701\u7565 folder \u53C2\u6570(\u4F20 undefined)\u3002"
141708
+ );
141709
+ }
141710
+ if (!folderId.startsWith("/")) {
141711
+ throw new EditorAPIError(
141712
+ "INVALID_PARAMETER",
141713
+ `folder \u5FC5\u987B\u662F vfs \u7EDD\u5BF9\u8DEF\u5F84(\u4EE5 / \u5F00\u5934),\u4F8B\u5982 "/Textures"\u3002\u6536\u5230: "${folderId}"`
141714
+ );
141715
+ }
141716
+ const vfs = ctx.vfs;
141717
+ const file2 = vfs.getFileByPath?.(folderId);
141718
+ if (!file2) {
141719
+ throw new EditorAPIError(
141720
+ "FOLDER_NOT_FOUND",
141721
+ `folder "${folderId}" \u4E0D\u5B58\u5728\u3002\u5728\u5F53\u524D\u5DE5\u5177\u4E4B\u524D\u8BF7\u5148\u8C03\u7528 folder.create({ path: "${folderId}", recursive: true }),folder.create \u662F\u5E42\u7B49\u7684(\u5DF2\u5B58\u5728\u7684 folder \u76F4\u63A5 reuse \u4E0D\u62A5\u9519),\u53EF\u653E\u5FC3\u9632\u5FA1\u6027\u8C03\u7528\u3002`
141722
+ );
141723
+ }
141724
+ const folder = ctx.assetStore.getAsset(file2.id);
141725
+ if (!folder) {
141726
+ throw new EditorAPIError(
141727
+ "FOLDER_NOT_FOUND",
141728
+ `folder "${folderId}" \u5728 vfs \u91CC\u6709 entry \u4F46\u5BF9\u5E94 asset \u4E0D\u5B58\u5728(\u5185\u90E8\u72B6\u6001\u4E0D\u4E00\u81F4)\u3002\u8BF7\u91CD\u8BD5\u6216\u5237\u65B0\u9875\u9762\u3002`
141729
+ );
141730
+ }
141731
+ const metaConfig = folder.getMetaConfig();
141732
+ if (metaConfig.type !== "Folder") {
141733
+ throw new EditorAPIError(
141734
+ "INVALID_PARAMETER",
141735
+ `\u8DEF\u5F84 "${folderId}" \u5DF2\u88AB ${metaConfig.type} \u8D44\u4EA7\u5360\u7528,\u65E0\u6CD5\u7528\u4F5C folder\u3002\u8BF7\u6539\u7528\u5176\u4ED6\u8DEF\u5F84\u540D(\u4F8B\u5982\u52A0\u590D\u6570 "/${folderId.replace(/^\//, "")}s" \u6216 "/${metaConfig.type}s/...")\u3002`
141736
+ );
141737
+ }
141738
+ return file2.id;
141739
+ }
141740
+ function normalizeColor2(color) {
141741
+ if (!color || typeof color !== "object")
141742
+ return void 0;
141743
+ const c6 = color;
141744
+ if (typeof c6.r === "number" && typeof c6.g === "number" && typeof c6.b === "number") {
141745
+ const a6 = typeof c6.a === "number" ? c6.a : 1;
141746
+ return [c6.r, c6.g, c6.b, a6];
141747
+ }
141748
+ if (Array.isArray(c6) && c6.length >= 3) {
141749
+ return [c6[0], c6[1], c6[2], c6[3] ?? 1];
141750
+ }
141751
+ return void 0;
141752
+ }
141753
+ var FOLDER_PARAM_DESCRIPTION;
141754
+ var init_helpers = __esm({
141755
+ "../editor-api/src/tools/asset/helpers.ts"() {
141756
+ "use strict";
141757
+ init_errors3();
141758
+ FOLDER_PARAM_DESCRIPTION = "\u76EE\u6807\u6587\u4EF6\u5939 vfs \u7EDD\u5BF9\u8DEF\u5F84(\u4EE5 / \u5F00\u5934,\u5982 '/Textures')\u3002\u7701\u7565\u5219\u521B\u5EFA\u5728\u6839\u76EE\u5F55\u3002**\u524D\u7F6E\u6761\u4EF6**:folder \u5FC5\u987B\u5148\u5B58\u5728 \u2014 \u63A8\u8350\u5728\u8C03\u7528\u672C\u5DE5\u5177\u524D\u5148\u8C03 folder.create({ path, recursive: true }) (\u5E42\u7B49,\u5DF2\u5B58\u5728\u4E0D\u62A5\u9519),\u907F\u514D FOLDER_NOT_FOUND\u3002";
141759
+ }
141760
+ });
141761
+
141570
141762
  // ../editor-api/src/tools/asset/material/schema.ts
141571
141763
  var TEXTURE_REF_DESC, materialPropsSchema, materialCreateInputSchema, materialReadInputSchema, materialUpdateInputSchema, materialDetailSchema, materialCreateOutputSchema, materialReadOutputSchema, materialUpdateOutputSchema;
141572
141764
  var init_schema = __esm({
@@ -141574,7 +141766,8 @@ var init_schema = __esm({
141574
141766
  "use strict";
141575
141767
  init_zod();
141576
141768
  init_common();
141577
- TEXTURE_REF_DESC = (kind) => `${kind}\u7EB9\u7406\u5F15\u7528:vfs \u7EDD\u5BF9\u8DEF\u5F84,\u5982 /Textures/diffuse\u3002output \u4E2D\u82E5\u5F15\u7528 builtin \u8D44\u4EA7\u6216\u4E0D\u5728 vfs,\u8FD4\u56DE null\u3002input \u4E2D\u76EE\u524D\u4E0D\u63A5\u53D7 null(\u6E05\u9664\u5F15\u7528\u7684\u8BED\u4E49\u672A\u5B9E\u73B0) \u2014 \u60F3\u4FDD\u6301\u539F\u5F15\u7528\u5C31\u7701\u7565\u8BE5\u5B57\u6BB5\u3002`;
141769
+ init_helpers();
141770
+ TEXTURE_REF_DESC = (kind) => `${kind}\u7EB9\u7406\u5F15\u7528:vfs \u7EDD\u5BF9\u8DEF\u5F84,**\u5FC5\u5E26\u7269\u7406\u6587\u4EF6\u540E\u7F00**(\u5982 .png/.jpg/.hdr),\u5982 /Textures/diffuse.png\u3002output \u4E2D\u82E5\u5F15\u7528 builtin \u8D44\u4EA7\u6216\u4E0D\u5728 vfs,\u8FD4\u56DE null\u3002input \u4E2D\u76EE\u524D\u4E0D\u63A5\u53D7 null(\u6E05\u9664\u5F15\u7528\u7684\u8BED\u4E49\u672A\u5B9E\u73B0) \u2014 \u60F3\u4FDD\u6301\u539F\u5F15\u7528\u5C31\u7701\u7565\u8BE5\u5B57\u6BB5\u3002`;
141578
141771
  materialPropsSchema = external_exports.object({
141579
141772
  // 颜色属性
141580
141773
  baseColor: colorSchema.optional().describe("\u57FA\u7840\u989C\u8272\uFF0C\u5982 {r:1, g:0, b:0, a:1} \u8868\u793A\u7EA2\u8272"),
@@ -141605,7 +141798,7 @@ var init_schema = __esm({
141605
141798
  }).describe("PBR \u6750\u8D28\u5C5E\u6027");
141606
141799
  materialCreateInputSchema = external_exports.object({
141607
141800
  name: external_exports.string().min(1).max(128).describe("\u6750\u8D28\u540D\u79F0"),
141608
- folder: external_exports.string().optional().describe("\u76EE\u6807\u6587\u4EF6\u5939 vfs \u8DEF\u5F84\uFF0C\u7701\u7565\u5219\u521B\u5EFA\u5728\u6839\u76EE\u5F55"),
141801
+ folder: external_exports.string().optional().describe(FOLDER_PARAM_DESCRIPTION),
141609
141802
  // 颜色
141610
141803
  baseColor: colorSchema.optional().default({ r: 1, g: 1, b: 1, a: 1 }).describe("\u57FA\u7840\u989C\u8272\uFF0C\u9ED8\u8BA4\u767D\u8272"),
141611
141804
  emissiveColor: colorSchema.optional().describe("\u81EA\u53D1\u5149\u989C\u8272"),
@@ -141631,10 +141824,10 @@ var init_schema = __esm({
141631
141824
  materials: external_exports.never({ message: "material.create \u662F\u5355\u4E2A\u64CD\u4F5C\uFF0C\u4E0D\u63A5\u53D7 materials \u6570\u7EC4\u3002\u6279\u91CF\u521B\u5EFA\u8BF7\u591A\u6B21\u8C03\u7528\u3002" }).optional()
141632
141825
  }).describe("\u521B\u5EFA\u6750\u8D28\u7684\u53C2\u6570");
141633
141826
  materialReadInputSchema = external_exports.object({
141634
- path: external_exports.string().describe("\u6750\u8D28\u8D44\u4EA7 vfs \u8DEF\u5F84\uFF0C\u5982 /Materials/foo")
141827
+ path: external_exports.string().describe("\u6750\u8D28\u8D44\u4EA7 vfs \u8DEF\u5F84,**\u5FC5\u5E26 .mat \u540E\u7F00**,\u5982 /Materials/foo.mat")
141635
141828
  }).describe("\u8BFB\u53D6\u6750\u8D28\u7684\u53C2\u6570");
141636
141829
  materialUpdateInputSchema = external_exports.object({
141637
- path: external_exports.string().describe("\u6750\u8D28\u8D44\u4EA7 vfs \u8DEF\u5F84\uFF0C\u5982 /Materials/foo"),
141830
+ path: external_exports.string().describe("\u6750\u8D28\u8D44\u4EA7 vfs \u8DEF\u5F84,**\u5FC5\u5E26 .mat \u540E\u7F00**,\u5982 /Materials/foo.mat"),
141638
141831
  // 颜色
141639
141832
  baseColor: colorSchema.optional().describe("\u57FA\u7840\u989C\u8272"),
141640
141833
  emissiveColor: colorSchema.optional().describe("\u81EA\u53D1\u5149\u989C\u8272"),
@@ -141674,109 +141867,6 @@ var init_schema = __esm({
141674
141867
  }
141675
141868
  });
141676
141869
 
141677
- // ../editor-api/src/tools/asset/helpers.ts
141678
- async function resolveAssetSnapshot(assetId, ctx, options) {
141679
- const { assetStore } = ctx;
141680
- const asset3 = assetStore.getAsset(assetId);
141681
- if (!asset3) {
141682
- throw new EditorAPIError("ASSET_NOT_FOUND", assetId);
141683
- }
141684
- const metaConfig = asset3.getMetaConfig();
141685
- let props = {};
141686
- if (typeof asset3.getMainData === "function") {
141687
- try {
141688
- const mainData = asset3.getMainData();
141689
- const assetType = metaConfig.type;
141690
- if (assetType === "script") {
141691
- if (typeof mainData === "string") {
141692
- props.code = mainData;
141693
- }
141694
- } else if (typeof mainData === "string") {
141695
- props = JSON.parse(mainData);
141696
- } else if (mainData && typeof mainData === "object") {
141697
- props = JSON.parse(JSON.stringify(mainData));
141698
- }
141699
- } catch {
141700
- }
141701
- }
141702
- if (options?.fallbackProps && Object.keys(options.fallbackProps).length > 0) {
141703
- props = { ...props, ...options.fallbackProps };
141704
- }
141705
- return {
141706
- path: getAssetPath(asset3.id, ctx),
141707
- name: asset3.name,
141708
- type: metaConfig.type,
141709
- props
141710
- };
141711
- }
141712
- function getAssetPath(assetId, ctx) {
141713
- if (!assetId)
141714
- return null;
141715
- const vfs = ctx.vfs;
141716
- const file2 = vfs?.getFileById?.(assetId);
141717
- return file2?.path ?? null;
141718
- }
141719
- function resolveAssetRef(ref, ctx, paramName = "ref") {
141720
- if (typeof ref !== "string") {
141721
- throw new EditorAPIError("INVALID_PARAMETER", `${paramName} \u5FC5\u987B\u662F\u5B57\u7B26\u4E32`);
141722
- }
141723
- if (!ref) {
141724
- throw new EditorAPIError("INVALID_PARAMETER", `${paramName} \u4E0D\u80FD\u4E3A\u7A7A`);
141725
- }
141726
- if (!ref.startsWith("/")) {
141727
- throw new EditorAPIError(
141728
- "INVALID_PARAMETER",
141729
- `${paramName} \u5FC5\u987B\u662F vfs \u7EDD\u5BF9\u8DEF\u5F84\uFF08\u4EE5 / \u5F00\u5934\uFF09\uFF0C\u4F8B\u5982 "/Materials/ground"\u3002\u6536\u5230: "${ref}"`
141730
- );
141731
- }
141732
- const vfs = ctx.vfs;
141733
- const file2 = vfs.getFileByPath?.(ref);
141734
- if (!file2) {
141735
- throw new EditorAPIError("ASSET_NOT_FOUND", `${paramName}: ${ref}`);
141736
- }
141737
- return file2.id;
141738
- }
141739
- function validateFolderExists(folderId, ctx) {
141740
- const { assetStore } = ctx;
141741
- const folder = assetStore.getAsset(folderId);
141742
- if (!folder) {
141743
- throw new EditorAPIError("FOLDER_NOT_FOUND", folderId);
141744
- }
141745
- const metaConfig = folder.getMetaConfig();
141746
- if (metaConfig.type !== "Folder") {
141747
- throw new EditorAPIError("INVALID_PARAMETER", `${folderId} is not a folder (type: ${metaConfig.type})`);
141748
- }
141749
- }
141750
- function validateFolderIdParam(folderId, ctx) {
141751
- if (folderId === void 0)
141752
- return void 0;
141753
- if (folderId === "") {
141754
- throw new EditorAPIError("INVALID_PARAMETER", "folder cannot be empty string, use undefined for root");
141755
- }
141756
- const folderUuid = resolveAssetRef(folderId, ctx, "folder");
141757
- validateFolderExists(folderUuid, ctx);
141758
- return folderUuid;
141759
- }
141760
- function normalizeColor2(color) {
141761
- if (!color || typeof color !== "object")
141762
- return void 0;
141763
- const c6 = color;
141764
- if (typeof c6.r === "number" && typeof c6.g === "number" && typeof c6.b === "number") {
141765
- const a6 = typeof c6.a === "number" ? c6.a : 1;
141766
- return [c6.r, c6.g, c6.b, a6];
141767
- }
141768
- if (Array.isArray(c6) && c6.length >= 3) {
141769
- return [c6[0], c6[1], c6[2], c6[3] ?? 1];
141770
- }
141771
- return void 0;
141772
- }
141773
- var init_helpers = __esm({
141774
- "../editor-api/src/tools/asset/helpers.ts"() {
141775
- "use strict";
141776
- init_errors3();
141777
- }
141778
- });
141779
-
141780
141870
  // ../editor-api/src/tools/asset/material/extract.ts
141781
141871
  function extractMaterialProperties(asset3, ctx) {
141782
141872
  const props = {};
@@ -142202,7 +142292,7 @@ var init_create_geometry = __esm({
142202
142292
  mesh: primitiveMeshEnum.describe("\u57FA\u7840\u7F51\u683C\u7C7B\u578B"),
142203
142293
  parentEntityId: external_exports.string().nullable().optional().describe("\u7236\u5B9E\u4F53 ID,\u4E0D\u4F20\u6216 null \u5219\u521B\u5EFA\u5728\u6839\u7EA7"),
142204
142294
  transform: transformSchema.optional().describe("\u521D\u59CB\u53D8\u6362\uFF08\u4F4D\u7F6E/\u65CB\u8F6C/\u7F29\u653E\uFF09"),
142205
- material: external_exports.string().optional().describe("\u6750\u8D28\u8D44\u4EA7\u5F15\u7528\uFF1Avfs \u7EDD\u5BF9\u8DEF\u5F84\uFF0C\u5982 /Materials/ground"),
142295
+ material: external_exports.string().optional().describe("\u6750\u8D28\u8D44\u4EA7\u5F15\u7528:vfs \u7EDD\u5BF9\u8DEF\u5F84,**\u5FC5\u5E26 .mat \u540E\u7F00**,\u5982 /Materials/ground.mat"),
142206
142296
  inlineMaterial: inlineMaterialSchema.optional().describe("\u5185\u8054\u6750\u8D28\u5B9A\u4E49\uFF08\u521B\u5EFA\u65B0\u6750\u8D28\uFF09")
142207
142297
  }).describe("\u521B\u5EFA\u5E26\u51E0\u4F55\u4F53\u7684\u5B9E\u4F53\u53C2\u6570");
142208
142298
  createGeometryOutputSchema = entityInfoSchema.extend({
@@ -142955,7 +143045,9 @@ var init_schemas3 = __esm({
142955
143045
  "\u7EC4\u4EF6\u7C7B\u578B\u540D,\u5982 'DirectLight'\u3001'Camera'\u3001'ParticleRenderer'\u3002\u6CE8:editor API \u4E2D\u7684 `ParticleRenderer` \u5BF9\u5E94 Galacean Engine 2.0 \u4E2D\u7684 `ParticleGenerator` \u7C7B(\u8FD0\u884C\u65F6\u5B9E\u9645\u7C7B\u540D)\u3002\u7F16\u8F91\u5668/\u84DD\u56FE\u5C42\u7528 `ParticleRenderer` \u547D\u540D,realizer \u5B9E\u9645\u64CD\u4F5C\u7684\u662F ParticleGenerator \u5B9E\u4F8B\u3002"
142956
143046
  ),
142957
143047
  props: external_exports.record(external_exports.string(), external_exports.unknown()).optional().describe("\u7EC4\u4EF6\u5C5E\u6027\uFF0C\u7ED3\u6784\u4E0E\u573A\u666F JSON \u4E00\u81F4"),
142958
- ref: external_exports.string().optional().describe("\u7EC4\u4EF6\u5F15\u7528\u8D44\u6E90\uFF1Avfs \u7EDD\u5BF9\u8DEF\u5F84\uFF0C\u5982 /Scripts/dice\u3002\u5982 Script \u7EC4\u4EF6\u7684\u811A\u672C\u8D44\u4EA7\u5F15\u7528"),
143048
+ ref: external_exports.string().optional().describe(
143049
+ "\u7EC4\u4EF6\u5F15\u7528\u8D44\u6E90:vfs \u7EDD\u5BF9\u8DEF\u5F84,**\u5FC5\u5E26 extname**(Script \u5FC5\u5E26 .ts),\u5982 /Scripts/dice.ts\u3002\u5982 Script \u7EC4\u4EF6\u7684\u811A\u672C\u8D44\u4EA7\u5F15\u7528"
143050
+ ),
142959
143051
  methods: external_exports.record(external_exports.string(), external_exports.unknown()).optional().describe(
142960
143052
  "\u7EC4\u4EF6\u65B9\u6CD5\u8C03\u7528\u5E8F\u5217(\u5982 ParticleRenderer.setMaterial\u3001Collider.addShape);\u7ED3\u6784\u4E0E\u573A\u666F JSON methods \u5B57\u6BB5\u4E00\u81F4\u3002\u6CE8:ParticleRenderer \u5728 Engine 2.0 \u4E2D\u5B9E\u9645\u662F ParticleGenerator \u7C7B(editor API \u5C42\u4FDD\u7559 ParticleRenderer \u547D\u540D)\u3002"
142961
143053
  )
@@ -143797,7 +143889,7 @@ var init_schema4 = __esm({
143797
143889
  "use strict";
143798
143890
  init_zod();
143799
143891
  MESH_REF_DESC = "\u7F51\u683C\u8D44\u4EA7\u5F15\u7528:vfs \u7EDD\u5BF9\u8DEF\u5F84,\u5FC5\u987B\u6307\u5411\u5355\u72EC Mesh \u8D44\u4EA7(\u5982 /Models/dice-mesh)\u3002\u26A0\uFE0F \u6574\u4F53 glTF \u6A21\u578B(\u542B\u5C42\u7EA7 + \u591A\u6750\u8D28)\u8BF7\u7528 gltf.instantiate \u800C\u4E0D\u662F\u624B\u6302 MeshRenderer;\u5185\u7F6E\u57FA\u7840\u7F51\u683C(Cube/Sphere \u7B49)\u8BF7\u7528 primitiveMesh \u5B57\u6BB5\u3002(output \u4E2D\u82E5\u5F15\u7528 builtin \u8D44\u4EA7\u6216\u4E0D\u5728 vfs,\u8FD4\u56DE null)";
143800
- MATERIAL_REF_DESC = "\u6750\u8D28\u8D44\u4EA7\u5F15\u7528\uFF1Avfs \u7EDD\u5BF9\u8DEF\u5F84\uFF0C\u5982 /Materials/ground\uFF08output \u4E2D\u82E5\u5F15\u7528 builtin \u8D44\u4EA7\u6216\u4E0D\u5728 vfs\uFF0C\u8FD4\u56DE null\uFF09";
143892
+ MATERIAL_REF_DESC = "\u6750\u8D28\u8D44\u4EA7\u5F15\u7528:vfs \u7EDD\u5BF9\u8DEF\u5F84,**\u5FC5\u5E26 .mat \u540E\u7F00**,\u5982 /Materials/ground.mat(output \u4E2D\u82E5\u5F15\u7528 builtin \u8D44\u4EA7\u6216\u4E0D\u5728 vfs,\u8FD4\u56DE null)";
143801
143893
  primitiveMeshTypeEnum = external_exports.enum(["Cube", "Sphere", "Plane", "Cylinder", "Capsule", "Cone", "Torus"]).describe("\u57FA\u7840\u7F51\u683C\u7C7B\u578B");
143802
143894
  meshRendererPropsSchema = external_exports.object({
143803
143895
  mesh: external_exports.string().nullable().optional().describe(MESH_REF_DESC),
@@ -145324,13 +145416,13 @@ var init_schema6 = __esm({
145324
145416
  init_zod();
145325
145417
  animatorAddInputSchema = external_exports.object({
145326
145418
  entityId: external_exports.string().describe("\u76EE\u6807\u5B9E\u4F53 ID"),
145327
- controller: external_exports.string().optional().describe("\u52A8\u753B\u63A7\u5236\u5668\u8D44\u4EA7\u5F15\u7528\uFF1Avfs \u7EDD\u5BF9\u8DEF\u5F84\uFF0C\u5982 /Animators/dice"),
145419
+ controller: external_exports.string().optional().describe("\u52A8\u753B\u63A7\u5236\u5668\u8D44\u4EA7\u5F15\u7528:vfs \u7EDD\u5BF9\u8DEF\u5F84,**\u5FC5\u5E26 .animCtrl \u540E\u7F00**,\u5982 /Animators/dice.animCtrl"),
145328
145420
  enabled: external_exports.boolean().optional().default(true).describe("\u662F\u5426\u542F\u7528\uFF0C\u9ED8\u8BA4 true"),
145329
145421
  speed: external_exports.number().optional().default(1).describe("\u52A8\u753B\u64AD\u653E\u901F\u5EA6\uFF0C\u9ED8\u8BA4 1")
145330
145422
  }).describe("\u6DFB\u52A0 Animator \u7EC4\u4EF6\u7684\u53C2\u6570");
145331
145423
  animatorUpdateInputSchema = external_exports.object({
145332
145424
  entityId: external_exports.string().describe("\u76EE\u6807\u5B9E\u4F53 ID"),
145333
- controller: external_exports.string().optional().describe("\u52A8\u753B\u63A7\u5236\u5668\u8D44\u4EA7\u5F15\u7528:vfs \u7EDD\u5BF9\u8DEF\u5F84,\u5982 /Animators/dice"),
145425
+ controller: external_exports.string().optional().describe("\u52A8\u753B\u63A7\u5236\u5668\u8D44\u4EA7\u5F15\u7528:vfs \u7EDD\u5BF9\u8DEF\u5F84,**\u5FC5\u5E26 .animCtrl \u540E\u7F00**,\u5982 /Animators/dice.animCtrl"),
145334
145426
  enabled: external_exports.boolean().optional().describe("\u662F\u5426\u542F\u7528\u7EC4\u4EF6"),
145335
145427
  speed: external_exports.number().optional().describe("\u52A8\u753B\u64AD\u653E\u901F\u5EA6")
145336
145428
  }).describe(
@@ -145338,7 +145430,7 @@ var init_schema6 = __esm({
145338
145430
  );
145339
145431
  animatorPropsSchema = external_exports.object({
145340
145432
  controller: external_exports.string().nullable().optional().describe(
145341
- "\u52A8\u753B\u63A7\u5236\u5668\u8D44\u4EA7\u5F15\u7528\uFF1Avfs \u7EDD\u5BF9\u8DEF\u5F84\uFF0C\u5982 /Animators/dice\uFF08output \u4E2D\u82E5\u5F15\u7528 builtin \u8D44\u4EA7\u6216\u4E0D\u5728 vfs\uFF0C\u8FD4\u56DE null\uFF09"
145433
+ "\u52A8\u753B\u63A7\u5236\u5668\u8D44\u4EA7\u5F15\u7528:vfs \u7EDD\u5BF9\u8DEF\u5F84,**\u5FC5\u5E26 .animCtrl \u540E\u7F00**,\u5982 /Animators/dice.animCtrl(output \u4E2D\u82E5\u5F15\u7528 builtin \u8D44\u4EA7\u6216\u4E0D\u5728 vfs,\u8FD4\u56DE null)"
145342
145434
  ),
145343
145435
  speed: external_exports.number().optional().describe("\u52A8\u753B\u64AD\u653E\u901F\u5EA6"),
145344
145436
  enabled: external_exports.boolean().optional().describe("\u662F\u5426\u542F\u7528")
@@ -145670,7 +145762,7 @@ var init_schema8 = __esm({
145670
145762
  entityId: external_exports.string().describe("\u76EE\u6807\u5B9E\u4F53 ID"),
145671
145763
  color: colorSchema.optional().default({ r: 1, g: 1, b: 1, a: 1 }).describe("\u56FE\u7247\u989C\u8272"),
145672
145764
  sprite: external_exports.string().optional().describe(
145673
- "Sprite \u8D44\u4EA7 vfs \u7EDD\u5BF9\u8DEF\u5F84,\u5982 /Sprites/icon\u3002\u26A0\uFE0F \u4E0D\u80FD\u76F4\u63A5\u4F20 Texture \u8DEF\u5F84(\u5982 /Textures/icon.png \u4F1A\u663E\u793A\u7A7A\u767D)\u3002Sprite \u662F Texture \u7684\u5305\u88C5(\u52A0 region/pivot/border \u914D\u7F6E),\u9700\u5148 `sprite.create({ name, texture: '/Textures/icon.png' })` \u521B\u5EFA,\u518D\u4F20 Sprite \u7684 path\u3002\u5B8C\u6574\u5DE5\u4F5C\u6D41:texture.create \u2192 sprite.create \u2192 uiImage.add"
145765
+ "Sprite \u8D44\u4EA7 vfs \u7EDD\u5BF9\u8DEF\u5F84,**\u5FC5\u5E26 .sprite \u540E\u7F00**,\u5982 /Sprites/icon.sprite\u3002\u26A0\uFE0F \u4E0D\u80FD\u76F4\u63A5\u4F20 Texture \u8DEF\u5F84(\u5982 /Textures/icon.png \u4F1A\u663E\u793A\u7A7A\u767D)\u3002Sprite \u662F Texture \u7684\u5305\u88C5(\u52A0 region/pivot/border \u914D\u7F6E),\u9700\u5148 `sprite.create({ name, texture: '/Textures/icon.png' })` \u521B\u5EFA,\u518D\u4F20 Sprite \u7684 path\u3002\u5B8C\u6574\u5DE5\u4F5C\u6D41:texture.create \u2192 sprite.create \u2192 uiImage.add"
145674
145766
  ),
145675
145767
  raycastEnabled: external_exports.boolean().optional().default(true).describe("\u662F\u5426\u63A5\u6536\u5C04\u7EBF\u68C0\u6D4B")
145676
145768
  }).describe("\u6DFB\u52A0 UIImage \u7EC4\u4EF6\u7684\u53C2\u6570");
@@ -145687,7 +145779,7 @@ var init_schema8 = __esm({
145687
145779
  horizontalAlignment: textHorizontalAlignmentEnum.optional().default("Center").describe("\u6C34\u5E73\u5BF9\u9F50"),
145688
145780
  verticalAlignment: textVerticalAlignmentEnum.optional().default("Center").describe("\u5782\u76F4\u5BF9\u9F50"),
145689
145781
  fontStyle: fontStyleEnum.optional().describe("\u5B57\u4F53\u6837\u5F0F"),
145690
- font: external_exports.string().optional().describe("\u5B57\u4F53\u8D44\u4EA7\u5F15\u7528\uFF1Avfs \u7EDD\u5BF9\u8DEF\u5F84\uFF0C\u5982 /Fonts/main"),
145782
+ font: external_exports.string().optional().describe("\u5B57\u4F53\u8D44\u4EA7\u5F15\u7528:vfs \u7EDD\u5BF9\u8DEF\u5F84,**\u5FC5\u5E26\u7269\u7406\u6587\u4EF6\u540E\u7F00**(.ttf/.otf/.woff),\u5982 /Fonts/main.ttf"),
145691
145783
  enableWrapping: external_exports.boolean().optional().default(true).describe("\u662F\u5426\u542F\u7528\u81EA\u52A8\u6362\u884C"),
145692
145784
  overflowMode: external_exports.enum(["Overflow", "Truncate"]).optional().describe("\u6EA2\u51FA\u6A21\u5F0F")
145693
145785
  }).describe("\u6DFB\u52A0 UIText \u7EC4\u4EF6\u7684\u53C2\u6570");
@@ -147506,6 +147598,7 @@ var init_create2 = __esm({
147506
147598
  handler: async (params, ctx) => {
147507
147599
  const { assetFacade } = ctx;
147508
147600
  const folderUuid = validateFolderIdParam(params.folder, ctx);
147601
+ assertAssetNameAvailable(params.name, folderUuid ?? null, "Material", ctx);
147509
147602
  const props = {};
147510
147603
  if (params.baseColor)
147511
147604
  props.baseColor = params.baseColor;
@@ -147552,6 +147645,7 @@ var init_schema10 = __esm({
147552
147645
  "use strict";
147553
147646
  init_zod();
147554
147647
  init_common();
147648
+ init_helpers();
147555
147649
  scriptTemplateEnum = external_exports.enum(["default", "stateMachine", "unlitUIScript", "pbrUIScript", "defaultUIScript"]);
147556
147650
  scriptSubTypeEnum = external_exports.enum(["Default", "StateMachine", "ShaderUI"]);
147557
147651
  scriptPropsSchema = external_exports.object({
@@ -147560,7 +147654,7 @@ var init_schema10 = __esm({
147560
147654
  }).describe("\u811A\u672C\u5C5E\u6027");
147561
147655
  scriptCreateInputSchema = external_exports.object({
147562
147656
  name: external_exports.string().min(1).max(128).describe("\u811A\u672C\u540D\u79F0\uFF0C\u5982 'MyScript.ts'"),
147563
- folder: external_exports.string().optional().describe("\u76EE\u6807\u6587\u4EF6\u5939 vfs \u8DEF\u5F84\uFF0C\u7701\u7565\u5219\u521B\u5EFA\u5728\u6839\u76EE\u5F55"),
147657
+ folder: external_exports.string().optional().describe(FOLDER_PARAM_DESCRIPTION),
147564
147658
  template: scriptTemplateEnum.optional().default("default").describe(
147565
147659
  "\u811A\u672C\u6A21\u677F\u7C7B\u578B,\u51B3\u5B9A\u521D\u59CB code \u5185\u5BB9:(1) 'default' \u2014 \u6807\u51C6 Script(onAwake/onStart/onUpdate),\u6700\u5E38\u7528,\u6302\u5230\u666E\u901A entity\u3002(2) 'stateMachine' \u2014 StateMachineScript,\u6302\u5728 AnimatorController \u7684 state \u4E0A,onStateEnter/Exit \u94A9\u5B50\u3002(3) 'defaultUIScript' / 'unlitUIScript' / 'pbrUIScript' \u2014 UI \u4E13\u7528 Script,Inspector \u8868\u5355\u542B UI/Material \u5B57\u6BB5\u3002"
147566
147660
  ),
@@ -147752,6 +147846,7 @@ var init_create3 = __esm({
147752
147846
  handler: async (params, ctx) => {
147753
147847
  const { assetFacade, assetStore } = ctx;
147754
147848
  const folderUuid = validateFolderIdParam(params.folder, ctx);
147849
+ assertAssetNameAvailable(normalizeScriptName(params.name), folderUuid ?? null, "Script", ctx);
147755
147850
  const result2 = await createScriptAssetInternal(
147756
147851
  {
147757
147852
  name: params.name,
@@ -148022,7 +148117,9 @@ var init_create4 = __esm({
148022
148117
  id: "asset.create",
148023
148118
  description: "\u521B\u5EFA\u8D44\u4EA7\u3002\u4F18\u5148\u7528\u4E13\u7528\u5DE5\u5177(material.create / texture.create / script.create / prefab.create / folder.create / animationClip.create / animatorController.create / audio.create / font.create / gltf.create / spine.create) \u2014 \u5B83\u4EEC\u6709\u66F4\u7CBE\u786E\u7684\u5B57\u6BB5\u3002\u672C\u5DE5\u5177\u7528\u4E8E\u4E13\u7528\u5DE5\u5177\u672A\u8986\u76D6\u7684\u7C7B\u578B(PhysicsMaterial / Markdown / Shader / ShaderChunk / SpriteAtlas / PrimitiveMesh / AmbientLight / XRReferenceImage \u7B49)\u3002",
148024
148119
  input: external_exports.object({
148025
- path: external_exports.string().describe("\u8D44\u4EA7\u7684\u76EE\u6807 vfs \u8DEF\u5F84,\u5982 /Materials/Steel \u6216 /Folder/SubFolder/Asset\u3002\u7236\u6587\u4EF6\u5939\u5FC5\u987B\u5B58\u5728"),
148120
+ path: external_exports.string().describe(
148121
+ "\u8D44\u4EA7\u7684\u76EE\u6807 vfs \u8DEF\u5F84,**\u5FC5\u5E26\u5BF9\u5E94\u7C7B\u578B\u7684 extname**(\u7531 type \u51B3\u5B9A)\u3002\u7236\u6587\u4EF6\u5939\u5FC5\u987B\u5B58\u5728\u3002extname \u901F\u67E5:Material\u2192.mat / Scene\u2192.scene / Prefab\u2192.prefab / Sprite\u2192.sprite / AnimationClip\u2192.anim / AnimatorController\u2192.animCtrl / Script\u2192.ts / Folder\u2192(\u65E0)\u3002\u4F8B:`/Materials/Steel.mat`\u3001`/Scenes/Main.scene`\u3001`/Folders/SubFolder`(Folder \u65E0 extname)\u3002"
148122
+ ),
148026
148123
  type: external_exports.string().describe(
148027
148124
  "\u8D44\u4EA7\u7C7B\u578B\u3002\u7ED3\u6784\u5316\u521B\u5EFA(props \u76F4\u63A5\u7ED9\u5C5E\u6027): Material / Script / Folder / Scene / Prefab / AnimationClip / AnimatorController / Sprite / SpriteAtlas / PrimitiveMesh / PhysicsMaterial / Markdown / Shader / ShaderChunk\u3002\u4E0A\u4F20\u521B\u5EFA(props.source \u5FC5\u586B,URL/\u672C\u5730\u8DEF\u5F84/data URI): Texture / Audio / glTF / Font / SpineSkeletonData / AmbientLight / XRReferenceImage"
148028
148125
  ),
@@ -148119,6 +148216,7 @@ var init_schema11 = __esm({
148119
148216
  "../editor-api/src/tools/asset/texture/schema.ts"() {
148120
148217
  "use strict";
148121
148218
  init_zod();
148219
+ init_helpers();
148122
148220
  init_common();
148123
148221
  textureTypeEnum = external_exports.enum(["Texture"]).describe("\u7EB9\u7406\u7C7B\u578B(2D \u7EB9\u7406)");
148124
148222
  textureFilterModeEnum = external_exports.enum(["Point", "Bilinear", "Trilinear"]).describe("\u7EB9\u7406\u8FC7\u6EE4\u6A21\u5F0F");
@@ -148142,15 +148240,15 @@ var init_schema11 = __esm({
148142
148240
  textureCreateInputSchema = textureCreateMetaSchema.extend({
148143
148241
  name: external_exports.string().min(1).max(128).describe("\u7EB9\u7406\u540D\u79F0"),
148144
148242
  textureType: textureTypeEnum.optional().default("Texture").describe("\u7EB9\u7406\u7C7B\u578B,\u9ED8\u8BA4 Texture(2D \u7EB9\u7406)"),
148145
- folder: external_exports.string().optional().describe("\u76EE\u6807\u6587\u4EF6\u5939 vfs \u8DEF\u5F84\uFF0C\u7701\u7565\u5219\u521B\u5EFA\u5728\u6839\u76EE\u5F55"),
148243
+ folder: external_exports.string().optional().describe(FOLDER_PARAM_DESCRIPTION),
148146
148244
  // 纹理来源(三选一)
148147
148245
  source: external_exports.string().min(1).optional().describe("\u7EB9\u7406\u6765\u6E90\uFF1AURL\u3001\u672C\u5730\u6587\u4EF6\u8DEF\u5F84\u6216 data URI\uFF08\u5982 data:image/png;base64,...\uFF09")
148148
148246
  }).describe("\u521B\u5EFA\u7EB9\u7406\u7684\u53C2\u6570");
148149
148247
  textureReadInputSchema = external_exports.object({
148150
- path: external_exports.string().describe("\u7EB9\u7406\u8D44\u4EA7 vfs \u8DEF\u5F84\uFF0C\u5982 /Textures/foo")
148248
+ path: external_exports.string().describe("\u7EB9\u7406\u8D44\u4EA7 vfs \u8DEF\u5F84,**\u5FC5\u5E26\u7269\u7406\u6587\u4EF6\u540E\u7F00**(\u7531\u6E90\u6587\u4EF6\u51B3\u5B9A,\u5982 .png/.jpg/.webp/.hdr),\u5982 /Textures/foo.png")
148151
148249
  }).describe("\u8BFB\u53D6\u7EB9\u7406\u7684\u53C2\u6570");
148152
148250
  textureUpdateInputSchema = external_exports.object({
148153
- path: external_exports.string().describe("\u7EB9\u7406\u8D44\u4EA7 vfs \u8DEF\u5F84\uFF0C\u5982 /Textures/foo"),
148251
+ path: external_exports.string().describe("\u7EB9\u7406\u8D44\u4EA7 vfs \u8DEF\u5F84,**\u5FC5\u5E26\u7269\u7406\u6587\u4EF6\u540E\u7F00**(\u7531\u6E90\u6587\u4EF6\u51B3\u5B9A,\u5982 .png/.jpg/.webp/.hdr),\u5982 /Textures/foo.png"),
148154
148252
  filterMode: textureFilterModeEnum.optional().describe("\u8FC7\u6EE4\u6A21\u5F0F"),
148155
148253
  wrapModeU: textureWrapModeEnum.optional().describe("U \u8F74\u73AF\u7ED5\u6A21\u5F0F"),
148156
148254
  wrapModeV: textureWrapModeEnum.optional().describe("V \u8F74\u73AF\u7ED5\u6A21\u5F0F"),
@@ -148158,7 +148256,7 @@ var init_schema11 = __esm({
148158
148256
  mipmap: external_exports.boolean().optional().describe("\u662F\u5426\u751F\u6210 mipmap")
148159
148257
  }).describe("\u66F4\u65B0\u7EB9\u7406\u7684\u53C2\u6570");
148160
148258
  textureDeleteInputSchema = external_exports.object({
148161
- path: external_exports.string().describe("\u7EB9\u7406\u8D44\u4EA7 vfs \u8DEF\u5F84\uFF0C\u5982 /Textures/foo")
148259
+ path: external_exports.string().describe("\u7EB9\u7406\u8D44\u4EA7 vfs \u8DEF\u5F84,**\u5FC5\u5E26\u7269\u7406\u6587\u4EF6\u540E\u7F00**(\u7531\u6E90\u6587\u4EF6\u51B3\u5B9A,\u5982 .png/.jpg/.webp/.hdr),\u5982 /Textures/foo.png")
148162
148260
  }).describe("\u5220\u9664\u7EB9\u7406\u7684\u53C2\u6570");
148163
148261
  textureDetailSchema = assetInfoSchema.extend({
148164
148262
  props: texturePropsSchema.optional().describe("\u7EB9\u7406\u5C5E\u6027")
@@ -148381,7 +148479,7 @@ var init_write = __esm({
148381
148479
  id: "asset.update",
148382
148480
  description: "\u66F4\u65B0\u8D44\u4EA7\u5C5E\u6027\u3002Material(PBR \u53C2\u6570)\u3001Texture(\u8FC7\u6EE4/\u73AF\u7ED5\u6A21\u5F0F)\u3001Script(\u6E90\u4EE3\u7801)\u3001Markdown(\u6587\u672C)\u3002Prefab/Scene \u7684\u5B9E\u4F53\u6570\u636E\u8BF7\u7528 entity.* / component.* \u5DE5\u5177\u3002",
148383
148481
  input: external_exports.object({
148384
- path: external_exports.string().describe("\u8D44\u4EA7 vfs \u8DEF\u5F84,\u5982 /Materials/Steel"),
148482
+ path: external_exports.string().describe("\u8D44\u4EA7 vfs \u8DEF\u5F84,**\u5FC5\u5E26 extname**,\u5982 /Materials/Steel.mat"),
148385
148483
  props: external_exports.record(external_exports.string(), external_exports.unknown()).describe("\u8981\u66F4\u65B0\u7684\u5C5E\u6027,\u5B57\u6BB5\u540D\u4E0E asset.read \u8F93\u51FA\u5BF9\u79F0")
148386
148484
  }),
148387
148485
  output: external_exports.object({
@@ -148423,8 +148521,10 @@ var init_move = __esm({
148423
148521
  id: "asset.move",
148424
148522
  description: "\u79FB\u52A8\u6216\u91CD\u547D\u540D\u8D44\u4EA7\u3002src \u662F\u539F\u8DEF\u5F84,dest \u662F\u65B0\u8DEF\u5F84(\u53EF\u6539\u7236\u76EE\u5F55\u3001\u6539\u6587\u4EF6\u540D\u3001\u6216\u540C\u65F6\u6539) \u2014 \u4E00\u4E2A\u5DE5\u5177\u8986\u76D6 move + rename\u3002\u76EE\u6807\u8DEF\u5F84\u5DF2\u5B58\u5728\u540C\u540D\u8D44\u4EA7(\u4E14\u4E0D\u662F src \u81EA\u8EAB)\u65F6\u629B INVALID_PARAMETER,\u907F\u514D\u5236\u9020 ambiguous path\u3002",
148425
148523
  input: external_exports.object({
148426
- src: external_exports.string().describe("\u6E90\u8D44\u4EA7 vfs \u8DEF\u5F84,\u5982 /Materials/Steel"),
148427
- dest: external_exports.string().describe("\u76EE\u6807 vfs \u8DEF\u5F84,\u5982 /Materials/Sub/Steel(\u79FB\u52A8)\u6216 /Materials/Iron(\u91CD\u547D\u540D)")
148524
+ src: external_exports.string().describe("\u6E90\u8D44\u4EA7 vfs \u8DEF\u5F84,**\u5FC5\u5E26 extname**,\u5982 /Materials/Steel.mat"),
148525
+ dest: external_exports.string().describe(
148526
+ "\u76EE\u6807 vfs \u8DEF\u5F84,**\u5FC5\u5E26 extname**,\u5982 /Materials/Sub/Steel.mat(\u79FB\u52A8)\u6216 /Materials/Iron.mat(\u91CD\u547D\u540D)\u3002extname \u5FC5\u987B\u8DDF src \u7684 type \u4E00\u81F4(asset.move \u4E0D\u6539 type)\u3002"
148527
+ )
148428
148528
  }),
148429
148529
  output: external_exports.object({
148430
148530
  name: external_exports.string(),
@@ -292052,7 +292152,8 @@ function assetIdToVirtualPath(state, assetId) {
292052
292152
  folders.unshift(folder.name);
292053
292153
  parentId = folder.parentFolderId;
292054
292154
  }
292055
- return `${folders.length ? `${folders.join("/")}/` : ""}${asset3.name}`;
292155
+ const assetName = asset3.type === "Folder" ? asset3.name : assetNameFromPath(asset3.name, asset3.type);
292156
+ return `${folders.length ? `${folders.join("/")}/` : ""}${assetName}`;
292056
292157
  }
292057
292158
  function virtualPathToAssetId(state, virtualPath) {
292058
292159
  if (state.assets[virtualPath])
@@ -292081,6 +292182,7 @@ function createSourceAssetKindResolver2(state) {
292081
292182
  var init_sceneSwap = __esm({
292082
292183
  "../model/src/headless/sceneSwap.ts"() {
292083
292184
  "use strict";
292185
+ init_sync_adapter();
292084
292186
  init_scene_file_v2();
292085
292187
  init_hydrateSourceV2SceneToDomain();
292086
292188
  }
@@ -292516,8 +292618,10 @@ var init_copy = __esm({
292516
292618
  id: "asset.copy",
292517
292619
  description: "\u590D\u5236\u8D44\u4EA7\u5230\u65B0\u8DEF\u5F84\u3002\u6587\u4EF6\u5939\u4F1A\u9012\u5F52\u590D\u5236\u6240\u6709\u5B50\u9879,\u5355\u6B21\u539F\u5B50\u64CD\u4F5C + \u5355\u6B21 undo \u5373\u53EF\u64A4\u9500\u6574\u6B21\u590D\u5236\u3002",
292518
292620
  input: external_exports.object({
292519
- src: external_exports.string().describe("\u6E90\u8D44\u4EA7 vfs \u8DEF\u5F84"),
292520
- dest: external_exports.string().describe("\u76EE\u6807 vfs \u8DEF\u5F84(\u542B\u65B0\u540D\u5B57),\u5982 /Materials/Steel_copy")
292621
+ src: external_exports.string().describe("\u6E90\u8D44\u4EA7 vfs \u8DEF\u5F84,**\u5FC5\u5E26 extname**,\u5982 /Materials/Steel.mat"),
292622
+ dest: external_exports.string().describe(
292623
+ "\u76EE\u6807 vfs \u8DEF\u5F84(\u542B\u65B0\u540D\u5B57),**\u5FC5\u5E26 extname**,\u5982 /Materials/Steel_copy.mat\u3002extname \u5FC5\u987B\u8DDF src \u7684 type \u4E00\u81F4(asset.copy \u4E0D\u6539 type)\u3002"
292624
+ )
292521
292625
  }),
292522
292626
  output: external_exports.object({
292523
292627
  name: external_exports.string(),
@@ -292663,6 +292767,7 @@ async function handleUploadAssetCreate(params, ctx, config2) {
292663
292767
  const { blob, ext } = await fetchBlobFromUrlOrPath(params.source, mimeMap, { urlValidator });
292664
292768
  await onBlobFetched?.(blob);
292665
292769
  const fileName = params.name.endsWith(ext) ? params.name : `${params.name}${ext}`;
292770
+ assertAssetNameAvailable(fileName, folderUuid ?? null, assetType, ctx);
292666
292771
  const file2 = new File([blob], fileName, { type: blob.type });
292667
292772
  const asset3 = await ctx.assetFacade.createAssetByUpload({
292668
292773
  uploadAssetFile: { main: file2 },
@@ -292766,9 +292871,10 @@ var init_schema12 = __esm({
292766
292871
  init_zod();
292767
292872
  init_src();
292768
292873
  init_common();
292874
+ init_helpers();
292769
292875
  audioCreateInputSchema = external_exports.object({
292770
292876
  name: external_exports.string().min(1).max(128).describe("\u97F3\u9891\u540D\u79F0"),
292771
- folder: external_exports.string().optional().describe("\u76EE\u6807\u6587\u4EF6\u5939 vfs \u8DEF\u5F84\uFF0C\u7701\u7565\u5219\u521B\u5EFA\u5728\u6839\u76EE\u5F55"),
292877
+ folder: external_exports.string().optional().describe(FOLDER_PARAM_DESCRIPTION),
292772
292878
  source: external_exports.string().min(1).optional().describe(`\u97F3\u9891\u6765\u6E90\uFF1AURL\u3001\u672C\u5730\u6587\u4EF6\u8DEF\u5F84\u6216 data URI\uFF08\u652F\u6301 ${AUDIO_EXT_LIST.join(" / ")}\uFF09`)
292773
292879
  }).describe("\u521B\u5EFA\u97F3\u9891\u8D44\u4EA7\u7684\u53C2\u6570");
292774
292880
  audioCreateOutputSchema = assetInfoSchema.describe("\u521B\u5EFA\u540E\u7684\u97F3\u9891\u8D44\u4EA7\u4FE1\u606F");
@@ -292817,9 +292923,10 @@ var init_schema13 = __esm({
292817
292923
  "use strict";
292818
292924
  init_zod();
292819
292925
  init_common();
292926
+ init_helpers();
292820
292927
  gltfCreateInputSchema = external_exports.object({
292821
292928
  name: external_exports.string().min(1).max(128).describe("glTF \u8D44\u4EA7\u540D\u79F0"),
292822
- folder: external_exports.string().optional().describe("\u76EE\u6807\u6587\u4EF6\u5939 vfs \u8DEF\u5F84\uFF0C\u7701\u7565\u5219\u521B\u5EFA\u5728\u6839\u76EE\u5F55"),
292929
+ folder: external_exports.string().optional().describe(FOLDER_PARAM_DESCRIPTION),
292823
292930
  source: external_exports.string().min(1).optional().describe(
292824
292931
  "glTF \u6765\u6E90\uFF1AURL\u3001\u672C\u5730\u6587\u4EF6\u8DEF\u5F84\u6216 data URI\u3002\u5F53\u524D\u4EC5\u652F\u6301 .glb \u5355\u6587\u4EF6\u683C\u5F0F\uFF08\u591A\u6587\u4EF6 .gltf+.bin+textures \u9700\u7528 zip \u65B9\u5F0F\u5BFC\u5165\uFF0CPhase 2\uFF09"
292825
292932
  )
@@ -292855,7 +292962,7 @@ var init_schema13 = __esm({
292855
292962
  }).describe("\u521B\u5EFA\u540E\u7684 glTF \u8D44\u4EA7\u4FE1\u606F");
292856
292963
  gltfImportZipInputSchema = external_exports.object({
292857
292964
  source: external_exports.string().min(1).describe("zip \u5305\u6765\u6E90\uFF1AURL / \u672C\u5730\u6587\u4EF6\u8DEF\u5F84 / data URI"),
292858
- folder: external_exports.string().optional().describe("\u76EE\u6807\u6587\u4EF6\u5939 vfs \u8DEF\u5F84\uFF0C\u7701\u7565\u5219\u521B\u5EFA\u5728\u6839\u76EE\u5F55"),
292965
+ folder: external_exports.string().optional().describe(FOLDER_PARAM_DESCRIPTION),
292859
292966
  name: external_exports.string().min(1).max(128).optional().describe("\u8D44\u4EA7\u540D\uFF08\u4E0D\u542B\u6269\u5C55\u540D\uFF09\uFF0C\u7701\u7565\u65F6\u4ECE zip \u5185\u4E3B\u6587\u4EF6\u540D\u63A8\u65AD")
292860
292967
  }).describe("\u4ECE zip \u5305\u5BFC\u5165\u591A\u6587\u4EF6 glTF \u7684\u53C2\u6570");
292861
292968
  gltfImportZipOutputSchema = assetInfoSchema.describe(
@@ -293513,7 +293620,7 @@ var require_stream_writable = __commonJS({
293513
293620
  pna.nextTick(cb, er);
293514
293621
  }
293515
293622
  function validChunk(stream, state, chunk2, cb) {
293516
- var valid = true;
293623
+ var valid2 = true;
293517
293624
  var er = false;
293518
293625
  if (chunk2 === null) {
293519
293626
  er = new TypeError("May not write null values to stream");
@@ -293523,9 +293630,9 @@ var require_stream_writable = __commonJS({
293523
293630
  if (er) {
293524
293631
  stream.emit("error", er);
293525
293632
  pna.nextTick(cb, er);
293526
- valid = false;
293633
+ valid2 = false;
293527
293634
  }
293528
- return valid;
293635
+ return valid2;
293529
293636
  }
293530
293637
  Writable.prototype.write = function(chunk2, encoding, cb) {
293531
293638
  var state = this._writableState;
@@ -302939,9 +303046,10 @@ var init_schema14 = __esm({
302939
303046
  "use strict";
302940
303047
  init_zod();
302941
303048
  init_common();
303049
+ init_helpers();
302942
303050
  fontCreateInputSchema = external_exports.object({
302943
303051
  name: external_exports.string().min(1).max(128).describe("\u5B57\u4F53\u540D\u79F0"),
302944
- folder: external_exports.string().optional().describe("\u76EE\u6807\u6587\u4EF6\u5939 vfs \u8DEF\u5F84\uFF0C\u7701\u7565\u5219\u521B\u5EFA\u5728\u6839\u76EE\u5F55"),
303052
+ folder: external_exports.string().optional().describe(FOLDER_PARAM_DESCRIPTION),
302945
303053
  source: external_exports.string().min(1).optional().describe("\u5B57\u4F53\u6765\u6E90\uFF1AURL\u3001\u672C\u5730\u6587\u4EF6\u8DEF\u5F84\u6216 data URI\uFF08\u652F\u6301 .ttf / .otf / .woff\uFF09")
302946
303054
  }).describe("\u521B\u5EFA\u5B57\u4F53\u8D44\u4EA7\u7684\u53C2\u6570");
302947
303055
  fontCreateOutputSchema = assetInfoSchema.describe("\u521B\u5EFA\u540E\u7684\u5B57\u4F53\u8D44\u4EA7\u4FE1\u606F");
@@ -302993,6 +303101,7 @@ var init_schema15 = __esm({
302993
303101
  "../editor-api/src/tools/asset/spine/schema.ts"() {
302994
303102
  "use strict";
302995
303103
  init_zod();
303104
+ init_helpers();
302996
303105
  init_common();
302997
303106
  sourceSchema = external_exports.object({
302998
303107
  source: external_exports.string().min(1).optional().describe("\u6765\u6E90\uFF1AURL\u3001\u672C\u5730\u6587\u4EF6\u8DEF\u5F84\u6216 data URI")
@@ -303002,7 +303111,7 @@ var init_schema15 = __esm({
303002
303111
  });
303003
303112
  spineCreateInputSchema = external_exports.object({
303004
303113
  name: external_exports.string().min(1).max(128).describe("Spine \u8D44\u4EA7\u57FA\u7840\u540D\uFF08\u4E0D\u542B\u6269\u5C55\u540D\uFF0C\u4F8B\u5982 'hero'\uFF09"),
303005
- folder: external_exports.string().optional().describe("\u76EE\u6807\u6587\u4EF6\u5939 vfs \u8DEF\u5F84\uFF0C\u7701\u7565\u5219\u521B\u5EFA\u5728\u6839\u76EE\u5F55"),
303114
+ folder: external_exports.string().optional().describe(FOLDER_PARAM_DESCRIPTION),
303006
303115
  skeleton: sourceSchema.describe("\u9AA8\u9ABC\u6570\u636E\u6587\u4EF6\uFF1A.json\uFF08\u6587\u672C\uFF09\u6216 .skel\uFF08\u4E8C\u8FDB\u5236\uFF09"),
303007
303116
  atlas: sourceSchema.describe("\u56FE\u96C6\u6587\u4EF6\uFF1A.atlas \u7EAF\u6587\u672C"),
303008
303117
  textures: external_exports.array(textureSourceSchema).min(1).describe("\u7EB9\u7406\u6587\u4EF6\u5217\u8868\uFF1A.png / .jpg / .jpeg / .webp\uFF0C\u81F3\u5C11 1 \u4E2A")
@@ -303130,6 +303239,7 @@ var init_create9 = __esm({
303130
303239
  assertSourcePresent(params.skeleton, "skeleton");
303131
303240
  assertSourcePresent(params.atlas, "atlas");
303132
303241
  params.textures.forEach((t8, i6) => assertSourcePresent(t8, `textures[${i6}]`));
303242
+ assertAssetNameAvailable(`${params.name}.atlas`, folderUuid ?? null, "SpineAtlas", ctx);
303133
303243
  const { rootStore: rootStore2 } = ctx;
303134
303244
  ensureAssetTypeRegistered(rootStore2.assetRegistry, "Texture");
303135
303245
  ensureAssetTypeRegistered(rootStore2.assetRegistry, "SpineAtlas");
@@ -303178,6 +303288,7 @@ var init_schema16 = __esm({
303178
303288
  "../editor-api/src/tools/asset/sprite/schema.ts"() {
303179
303289
  "use strict";
303180
303290
  init_zod();
303291
+ init_helpers();
303181
303292
  init_common();
303182
303293
  spriteRegionSchema = external_exports.object({
303183
303294
  x: external_exports.number().min(0).max(1).describe("\u533A\u57DF\u8D77\u70B9 x(0-1,texture \u5F52\u4E00\u5316\u5750\u6807)"),
@@ -303197,7 +303308,7 @@ var init_schema16 = __esm({
303197
303308
  }).describe("\u4E5D\u5BAB\u683C Sliced/Tiled \u6A21\u5F0F\u7684 border,\u9ED8\u8BA4\u5168 0(\u666E\u901A Simple \u6A21\u5F0F\u4E0D\u7528)");
303198
303309
  spriteCreateInputSchema = external_exports.object({
303199
303310
  name: external_exports.string().min(1).max(128).describe("Sprite \u8D44\u4EA7\u540D\u79F0(\u4E0D\u542B\u6269\u5C55\u540D)"),
303200
- folder: external_exports.string().optional().describe("\u76EE\u6807\u6587\u4EF6\u5939 vfs \u8DEF\u5F84,\u7701\u7565\u5219\u521B\u5EFA\u5728\u6839\u76EE\u5F55"),
303311
+ folder: external_exports.string().optional().describe(FOLDER_PARAM_DESCRIPTION),
303201
303312
  texture: external_exports.string().describe(
303202
303313
  "\u5FC5\u586B,Texture \u8D44\u4EA7 vfs \u7EDD\u5BF9\u8DEF\u5F84,\u5982 /Textures/logo.png\u3002Sprite \u662F Texture \u7684**\u5305\u88C5**,\u5FC5\u987B\u5148 texture.create({ source:... }) \u6216 asset.create({ type:'Texture', props:{ source:... }}) \u521B\u5EFA Texture,\u518D\u7528 sprite.create \u5305\u88C5\u3002uiImage.add / spriteRenderer.add \u5F15\u7528\u7684\u4E0D\u662F Texture,\u662F Sprite,\u6240\u4EE5\u8FD9\u4E00\u6B65\u4E0D\u80FD\u7701\u3002"
303203
303314
  ),
@@ -303227,6 +303338,7 @@ var init_create10 = __esm({
303227
303338
  output: spriteCreateOutputSchema,
303228
303339
  handler: async (params, ctx) => {
303229
303340
  const folderUuid = validateFolderIdParam(params.folder, ctx);
303341
+ assertAssetNameAvailable(params.name, folderUuid ?? null, "Sprite", ctx);
303230
303342
  const textureUuid = resolveAssetRef(params.texture, ctx, "texture");
303231
303343
  const textureAsset = ctx.assetStore.getAsset(textureUuid);
303232
303344
  if (!textureAsset) {
@@ -303279,6 +303391,7 @@ var init_schema17 = __esm({
303279
303391
  "use strict";
303280
303392
  init_zod();
303281
303393
  init_common();
303394
+ init_helpers();
303282
303395
  animationClipInterpolationEnum = external_exports.enum(["Linear", "CubicSpine", "Step", "Hermite"]).describe("\u63D2\u503C\u65B9\u5F0F;Linear=\u7EBF\u6027(\u9ED8\u8BA4),Step=\u9636\u68AF,CubicSpine=\u4E09\u6B21\u6837\u6761,Hermite=Hermite \u66F2\u7EBF");
303283
303396
  keyframeValueTypeEnum = external_exports.enum(["Number", "Boolean", "Vector2", "Vector3", "Vector4", "Color"]).describe(
303284
303397
  "\u5173\u952E\u5E27\u503C\u7C7B\u578B;Number=\u6807\u91CF\u3001Boolean=\u5E03\u5C14\u3001Vector2={x,y}\u3001Vector3={x,y,z}\u3001Vector4={x,y,z,w}\u3001Color={r,g,b,a}\u3002Transform.position \u7528 Vector3,rotation \u7528 Vector3 (\u6B27\u62C9) \u6216 Vector4 (\u56DB\u5143\u6570)"
@@ -303316,7 +303429,7 @@ var init_schema17 = __esm({
303316
303429
  }).describe("\u52A8\u753B\u4E8B\u4EF6;\u5230\u8FBE time \u65F6\u8C03\u7528 entity \u4E0A\u811A\u672C\u7684 functionName(parameter)");
303317
303430
  animationClipCreateInputSchema = external_exports.object({
303318
303431
  name: external_exports.string().min(1).max(128).describe("\u52A8\u753B\u7247\u6BB5\u540D\u79F0"),
303319
- folder: external_exports.string().optional().describe("\u76EE\u6807\u6587\u4EF6\u5939 vfs \u8DEF\u5F84,\u7701\u7565\u5219\u521B\u5EFA\u5728\u6839\u76EE\u5F55"),
303432
+ folder: external_exports.string().optional().describe(FOLDER_PARAM_DESCRIPTION),
303320
303433
  tracks: external_exports.array(animationClipTrackSchema).optional().describe(
303321
303434
  "\u52A8\u753B tracks \u5217\u8868;\u6BCF\u6761 track \u7ED1\u5B9A entity \u4E0A\u4E00\u4E2A\u7EC4\u4EF6\u5C5E\u6027 + \u5173\u952E\u5E27\u5E8F\u5217\u3002\u3010\u793A\u4F8B 1:Transform.position 1 \u79D2\u5185\u5411\u4E0A\u8DF3\u8DC3 2 \u7C73\u3011[{ targetPath: '', componentType: 'Transform', property: 'position', valueType: 'Vector3', keys: [{ time: 0, value: {x:0,y:0,z:0} }, { time: 0.5, value: {x:0,y:2,z:0} }, { time: 1, value: {x:0,y:0,z:0} }] }]\u3010\u793A\u4F8B 2:\u5B50\u5B9E\u4F53\u7684\u65CB\u8F6C (Y \u8F74 360\xB0)\u3011[{ targetPath: 'spine/leftArm', componentType: 'Transform', property: 'rotation', valueType: 'Vector3', keys: [{ time: 0, value: {x:0,y:0,z:0} }, { time: 1, value: {x:0,y:360,z:0} }] }]\u3010\u793A\u4F8B 3:MeshRenderer \u6750\u8D28\u989C\u8272\u6E10\u53D8 (\u7EA2 \u2192 \u84DD)\u3011[{ targetPath: '', componentType: 'MeshRenderer', property: 'material.baseColor', valueType: 'Color', keys: [{ time: 0, value: {r:1,g:0,b:0,a:1} }, { time: 1, value: {r:0,g:0,b:1,a:1} }] }]\u3010\u793A\u4F8B 4:\u591A track \u540C\u6B65 (\u4F4D\u7F6E + \u7F29\u653E \u4E00\u5E76\u6539)\u3011[{ targetPath: '', componentType: 'Transform', property: 'position', valueType: 'Vector3', keys: [{time:0,value:{x:0,y:0,z:0}},{time:1,value:{x:5,y:0,z:0}}] }, { targetPath: '', componentType: 'Transform', property: 'scale', valueType: 'Vector3', keys: [{time:0,value:{x:1,y:1,z:1}},{time:1,value:{x:2,y:2,z:2}}] }]\u5E38\u89C1\u9519\u8BEF:Vector3 \u6F0F\u5199 z \u5B57\u6BB5 \u2192 \u88AB Zod 2D union \u62A2\u5339\u914D\u9759\u9ED8\u4E22\u5B57\u6BB5\u3002\u5EFA\u8BAE\u663E\u5F0F\u58F0\u660E valueType \u8BA9 handler \u5F3A\u6821\u9A8C\u3002"
303322
303435
  ),
@@ -303413,6 +303526,7 @@ var init_create11 = __esm({
303413
303526
  output: animationClipCreateOutputSchema,
303414
303527
  handler: async (params, ctx) => {
303415
303528
  const folderUuid = validateFolderIdParam(params.folder, ctx);
303529
+ assertAssetNameAvailable(params.name, folderUuid ?? null, "AnimationClip", ctx);
303416
303530
  const asset3 = await ctx.assetFacade.createAssetByAdd({
303417
303531
  assetType: "AnimationClip",
303418
303532
  name: params.name,
@@ -303454,6 +303568,7 @@ var init_schema18 = __esm({
303454
303568
  "use strict";
303455
303569
  init_zod();
303456
303570
  init_common();
303571
+ init_helpers();
303457
303572
  animatorLayerBlendingModeEnum = external_exports.enum(["Override", "Additive"]).describe("\u5C42\u6DF7\u5408\u6A21\u5F0F;Override=\u8986\u76D6\u6DF7\u5408(\u9ED8\u8BA4),Additive=\u52A0\u6CD5\u6DF7\u5408(\u5206\u5C42\u52A8\u753B\u53E0\u52A0)");
303458
303573
  animatorWrapModeEnum = external_exports.enum(["Loop", "Once"]).describe("\u52A8\u753B wrap \u884C\u4E3A;Loop=\u5FAA\u73AF(\u9ED8\u8BA4),Once=\u64AD\u653E\u4E00\u6B21\u540E\u505C\u5728\u672B\u5E27");
303459
303574
  animatorConditionModeEnum = external_exports.enum(["Equals", "NotEquals", "Greater", "Less", "If", "IfNot"]).describe("Transition \u6761\u4EF6\u6BD4\u8F83\u6A21\u5F0F");
@@ -303502,7 +303617,7 @@ var init_schema18 = __esm({
303502
303617
  }).describe("AnimatorController \u53C2\u6570\u5B9A\u4E49");
303503
303618
  animatorControllerCreateInputSchema = external_exports.object({
303504
303619
  name: external_exports.string().min(1).max(128).describe("AnimatorController \u8D44\u4EA7\u540D(\u4E0D\u542B\u6269\u5C55\u540D)"),
303505
- folder: external_exports.string().optional().describe("\u76EE\u6807\u6587\u4EF6\u5939 vfs \u8DEF\u5F84,\u7701\u7565\u5219\u521B\u5EFA\u5728\u6839\u76EE\u5F55"),
303620
+ folder: external_exports.string().optional().describe(FOLDER_PARAM_DESCRIPTION),
303506
303621
  layers: external_exports.array(animatorLayerSchema).optional().describe(
303507
303622
  "\u5C42\u5217\u8868(\u53EF\u9009);\u7701\u7565\u5219\u521B\u5EFA\u4E00\u4E2A\u7A7A\u7684 'Base' \u5C42(weight=1, blendingMode=Override, \u65E0 state)\u3002\u3010\u793A\u4F8B 1:\u5355\u5C42 idle \u2194 run \u5207\u6362\u3011[{ name: 'Base', stateMachine: { defaultStateName: 'idle', states: [{ name: 'idle', clip: '/Animations/idle.anim', wrapMode: 'Loop' }, { name: 'run', clip: '/Animations/run.anim', wrapMode: 'Loop', transitions: [{ destinationStateName: 'idle', conditions: [{ parameterName: 'speed', mode: 'Less', threshold: 0.1 }] }] }] } }]\u3010\u793A\u4F8B 2:\u53CC\u5C42 blending (\u4E0B\u534A\u8EAB walk + \u4E0A\u534A\u8EAB attack)\u3011[{ name: 'LowerBody', weight: 1, blendingMode: 'Override', stateMachine: { defaultStateName: 'walk', states: [{ name: 'walk', clip: '/Animations/walk.anim', wrapMode: 'Loop' }] } }, { name: 'UpperBody', weight: 1, blendingMode: 'Additive', stateMachine: { defaultStateName: 'idleUpper', states: [ { name: 'idleUpper', clip: '/Animations/idle_upper.anim', wrapMode: 'Loop' }, { name: 'attack', clip: '/Animations/attack.anim', wrapMode: 'Once', transitions: [{ destinationStateName: 'idleUpper', hasExitTime: true, exitTime: 1.0 }] }] } }]\u3010\u793A\u4F8B 3:Trigger \u9A71\u52A8\u8DF3\u8F6C (\u6309\u4E00\u6B21\u8DF3\u8DC3)\u3011[{ name: 'Base', stateMachine: { defaultStateName: 'idle', states: [{ name: 'idle', clip: '/Animations/idle.anim', transitions: [{ destinationStateName: 'jump', conditions: [{ parameterName: 'jumpTrigger' }] }] }, { name: 'jump', clip: '/Animations/jump.anim', wrapMode: 'Once', transitions: [{ destinationStateName: 'idle', hasExitTime: true, exitTime: 1.0 }] }] } }] (\u914D\u5957 parameters: [{ name: 'jumpTrigger', type: 'Trigger' }])"
303508
303623
  ),
@@ -303728,6 +303843,7 @@ var init_create12 = __esm({
303728
303843
  output: animatorControllerCreateOutputSchema,
303729
303844
  handler: async (params, ctx) => {
303730
303845
  const folderUuid = validateFolderIdParam(params.folder, ctx);
303846
+ assertAssetNameAvailable(params.name, folderUuid ?? null, "AnimatorController", ctx);
303731
303847
  const content = buildContent(params, ctx);
303732
303848
  const asset3 = await ctx.assetFacade.createAssetByAdd({
303733
303849
  assetType: "AnimatorController",
@@ -303757,7 +303873,7 @@ var init_read10 = __esm({
303757
303873
  init_schema18();
303758
303874
  init_storage();
303759
303875
  animatorControllerReadInputSchema = external_exports.object({
303760
- path: external_exports.string().describe("AnimatorController \u8D44\u4EA7 vfs \u8DEF\u5F84,\u5982 /Animators/dice")
303876
+ path: external_exports.string().describe("AnimatorController \u8D44\u4EA7 vfs \u8DEF\u5F84,**\u5FC5\u5E26 .animCtrl \u540E\u7F00**,\u5982 /Animators/dice.animCtrl")
303761
303877
  }).describe("\u8BFB\u53D6 AnimatorController \u8D44\u4EA7\u7684\u53C2\u6570");
303762
303878
  animatorControllerReadOutputSchema = animatorControllerCreateOutputSchema.extend({
303763
303879
  // 返回结构跟 create input 一致,LLM 可以直接吃进去给 asset.update
@@ -304097,7 +304213,7 @@ var init_create13 = __esm({
304097
304213
  init_headless();
304098
304214
  folderCreate = defineTool({
304099
304215
  id: "folder.create",
304100
- description: "\u521B\u5EFA\u6587\u4EF6\u5939\u3002recursive=true(\u9ED8\u8BA4)\u65F6\u7C7B\u4F3C Unix mkdir -p,\u9012\u5F52\u521B\u5EFA\u4E2D\u95F4\u76EE\u5F55\u3002recursive=false \u65F6\u7236\u76EE\u5F55\u5FC5\u987B\u5DF2\u5B58\u5728\u3002",
304216
+ description: "\u521B\u5EFA\u6587\u4EF6\u5939\u3002**\u5E42\u7B49** \u2014 \u5DF2\u5B58\u5728\u7684 folder \u76F4\u63A5 reuse \u4E0D\u62A5\u9519,\u53EF\u653E\u5FC3\u9632\u5FA1\u6027\u8C03\u7528\u3002recursive=true(\u9ED8\u8BA4)\u65F6\u7C7B\u4F3C Unix mkdir -p,\u9012\u5F52\u521B\u5EFA\u4E2D\u95F4\u76EE\u5F55\u3002recursive=false \u65F6\u7236\u76EE\u5F55\u5FC5\u987B\u5DF2\u5B58\u5728\u3002**\u4F7F\u7528\u5EFA\u8BAE**:\u5728 texture.create / sprite.create / material.create / scene.create \u7B49\u4EFB\u4F55\u63A5\u53D7 folder \u53C2\u6570\u7684\u5DE5\u5177\u4E4B\u524D,\u90FD\u5E94\u8BE5\u5148\u8C03\u4E00\u6B21 folder.create({ path, recursive: true }) \u786E\u4FDD folder \u5B58\u5728\u3002**\u8DEF\u5F84\u51B2\u7A81**:\u67D0\u4E9B\u8DEF\u5F84\u5DF2\u88AB\u9879\u76EE\u9ED8\u8BA4\u8D44\u4EA7\u5360\u7528(\u5982\u6839 Scene \u8D44\u4EA7\u5360\u7528 /Scene),\u4F1A\u629B INVALID_PARAMETER,\u6B64\u65F6\u5E94\u6539\u7528\u5176\u4ED6\u8DEF\u5F84\u540D(\u4F8B\u5982 /Scenes \u590D\u6570\u5F62\u5F0F)\u3002",
304101
304217
  input: folderCreateInputSchema,
304102
304218
  output: folderCreateOutputSchema,
304103
304219
  handler: async (params, ctx) => {
@@ -304258,18 +304374,21 @@ var init_schema20 = __esm({
304258
304374
  "use strict";
304259
304375
  init_zod();
304260
304376
  init_common();
304377
+ init_helpers();
304261
304378
  prefabCreateInputSchema = external_exports.object({
304262
304379
  entityId: external_exports.string().describe("\u6E90\u5B9E\u4F53 ID\uFF0C\u5C06\u6B64\u5B9E\u4F53\u53CA\u5176\u5B50\u5B9E\u4F53\u4FDD\u5B58\u4E3A\u9884\u5236\u4EF6"),
304263
304380
  name: external_exports.string().optional().describe("\u9884\u5236\u4EF6\u540D\u79F0\uFF0C\u9ED8\u8BA4\u4F7F\u7528\u5B9E\u4F53\u540D\u79F0"),
304264
- folder: external_exports.string().optional().describe("\u76EE\u6807\u6587\u4EF6\u5939 vfs \u8DEF\u5F84\uFF0C\u7701\u7565\u5219\u521B\u5EFA\u5728\u6839\u76EE\u5F55")
304381
+ folder: external_exports.string().optional().describe(FOLDER_PARAM_DESCRIPTION)
304265
304382
  }).describe(
304266
304383
  "\u4ECE\u573A\u666F\u5185\u5B9E\u4F53\u521B\u5EFA Prefab \u8D44\u4EA7\u7684\u53C2\u6570\u3002\u9002\u7528:\u5DF2\u7ECF\u5728\u573A\u666F\u91CC\u624B\u6302\u597D\u5C42\u7EA7\u548C\u7EC4\u4EF6\u7684\u5B9E\u4F53,\u60F3\u4FDD\u5B58\u4E3A\u9884\u5236\u4EF6\u590D\u7528\u3002\u5BF9\u6BD4 asset.create({ type: 'Prefab', props: <source v2 prefab file> }):\u540E\u8005\u4ECE\u539F\u59CB prefab \u6587\u4EF6\u7ED3\u6784(JSON)\u76F4\u63A5\u521B\u5EFA,\u9002\u7528\u4EE3\u7801\u751F\u6210\u3002"
304267
304384
  );
304268
304385
  prefabReadInputSchema = external_exports.object({
304269
- prefab: external_exports.string().describe("\u9884\u5236\u4EF6\u8D44\u4EA7 vfs \u8DEF\u5F84\uFF0C\u5982 /Prefabs/foo\u3002glTF \u8D44\u4EA7\u901A\u7528\u5143\u4FE1\u606F\u8BF7\u7528 asset.info\u3002")
304386
+ prefab: external_exports.string().describe(
304387
+ "\u9884\u5236\u4EF6\u8D44\u4EA7 vfs \u8DEF\u5F84,**\u5FC5\u5E26 .prefab \u540E\u7F00**,\u5982 /Prefabs/foo.prefab\u3002glTF \u8D44\u4EA7\u901A\u7528\u5143\u4FE1\u606F\u8BF7\u7528 asset.info\u3002"
304388
+ )
304270
304389
  }).describe("\u8BFB\u53D6\u9884\u5236\u4EF6\u8D44\u4EA7\u4FE1\u606F\u7684\u53C2\u6570");
304271
304390
  prefabInstantiateInputSchema = external_exports.object({
304272
- prefab: external_exports.string().describe("\u9884\u5236\u4EF6\u8D44\u4EA7 vfs \u8DEF\u5F84,\u5982 /Prefabs/foo\u3002glTF \u6A21\u578B\u8BF7\u7528 gltf.instantiate\u3002"),
304391
+ prefab: external_exports.string().describe("\u9884\u5236\u4EF6\u8D44\u4EA7 vfs \u8DEF\u5F84,**\u5FC5\u5E26 .prefab \u540E\u7F00**,\u5982 /Prefabs/foo.prefab\u3002glTF \u6A21\u578B\u8BF7\u7528 gltf.instantiate\u3002"),
304273
304392
  parentEntityId: external_exports.string().optional().describe("\u7236\u5B9E\u4F53 ID,\u9ED8\u8BA4\u4E3A\u573A\u666F\u6839\u8282\u70B9"),
304274
304393
  position: vector3Schema.optional().describe("\u5B9E\u4F8B\u5316\u4F4D\u7F6E\uFF0C\u9ED8\u8BA4\u4E3A\u539F\u70B9"),
304275
304394
  rotation: vector3Schema.optional().describe("\u5B9E\u4F8B\u5316\u65CB\u8F6C\uFF08\u6B27\u62C9\u89D2\uFF09\uFF0C\u9ED8\u8BA4\u4E3A\u96F6\u65CB\u8F6C"),
@@ -304359,6 +304478,7 @@ var init_create14 = __esm({
304359
304478
  }
304360
304479
  const folderUuid = validateFolderIdParam(params.folder, ctx);
304361
304480
  const prefabName = params.name ?? entityModel?.name ?? domainEntity?.name ?? "Prefab";
304481
+ assertAssetNameAvailable(prefabName, folderUuid ?? null, "Prefab", ctx);
304362
304482
  const entitySource = entityModel ?? domainEntity;
304363
304483
  const prefabAsset = await assetFacade.createAssetByAdd({
304364
304484
  assetType: "Prefab",
@@ -304590,7 +304710,7 @@ var init_schema21 = __esm({
304590
304710
  audioSourceAddInputSchema = external_exports.object({
304591
304711
  entityId: external_exports.string().describe("\u76EE\u6807\u5B9E\u4F53 ID"),
304592
304712
  clip: external_exports.string().optional().describe(
304593
- "AudioClip \u8D44\u4EA7\u5F15\u7528:vfs \u7EDD\u5BF9\u8DEF\u5F84,\u5982 /Audio/click\u3002\u5DE5\u4F5C\u6D41:asset.create({ type: 'Audio', props: { source: <url|path|dataURI> } }) \u6216 audio.create \u4E0A\u4F20\u97F3\u9891 \u2192 audioSource.add \u5F15\u7528\u5B83\u3002"
304713
+ "AudioClip \u8D44\u4EA7\u5F15\u7528:vfs \u7EDD\u5BF9\u8DEF\u5F84,**\u5FC5\u5E26\u7269\u7406\u6587\u4EF6\u540E\u7F00**(.mp3/.wav/.ogg),\u5982 /Audio/click.mp3\u3002\u5DE5\u4F5C\u6D41:asset.create({ type: 'Audio', props: { source: <url|path|dataURI> } }) \u6216 audio.create \u4E0A\u4F20\u97F3\u9891 \u2192 audioSource.add \u5F15\u7528\u5B83\u3002"
304594
304714
  ),
304595
304715
  volume: external_exports.number().min(0).max(1).optional().describe("\u97F3\u91CF(0-1),\u9ED8\u8BA4 1"),
304596
304716
  loop: external_exports.boolean().optional().describe("\u662F\u5426\u5FAA\u73AF\u64AD\u653E,\u9ED8\u8BA4 false"),
@@ -304602,7 +304722,7 @@ var init_schema21 = __esm({
304602
304722
  audioSourceUpdateInputSchema = external_exports.object({
304603
304723
  entityId: external_exports.string().describe("\u76EE\u6807\u5B9E\u4F53 ID"),
304604
304724
  componentId: external_exports.string().optional().describe("\u7EC4\u4EF6 ID\uFF08\u7CBE\u786E\u5B9A\u4F4D\uFF09"),
304605
- clip: external_exports.string().optional().describe("AudioClip \u8D44\u4EA7\u5F15\u7528\uFF1Avfs \u7EDD\u5BF9\u8DEF\u5F84\uFF0C\u5982 /Audio/click"),
304725
+ clip: external_exports.string().optional().describe("AudioClip \u8D44\u4EA7\u5F15\u7528:vfs \u7EDD\u5BF9\u8DEF\u5F84,**\u5FC5\u5E26\u7269\u7406\u6587\u4EF6\u540E\u7F00**(.mp3/.wav/.ogg),\u5982 /Audio/click.mp3"),
304606
304726
  volume: external_exports.number().min(0).max(1).optional().describe("\u97F3\u91CF (0-1)"),
304607
304727
  loop: external_exports.boolean().optional().describe("\u662F\u5426\u5FAA\u73AF\u64AD\u653E"),
304608
304728
  playOnEnabled: external_exports.boolean().optional().describe("\u7EC4\u4EF6\u542F\u7528\u65F6\u81EA\u52A8\u64AD\u653E"),
@@ -304612,7 +304732,7 @@ var init_schema21 = __esm({
304612
304732
  }).describe("\u66F4\u65B0 AudioSource \u7EC4\u4EF6\u7684\u53C2\u6570");
304613
304733
  audioSourcePropsSchema = external_exports.object({
304614
304734
  clip: external_exports.string().nullable().optional().describe(
304615
- "AudioClip \u8D44\u4EA7\u5F15\u7528\uFF1Avfs \u7EDD\u5BF9\u8DEF\u5F84\uFF0C\u5982 /Audio/click\uFF08output \u4E2D\u82E5\u5F15\u7528 builtin \u8D44\u4EA7\u6216\u4E0D\u5728 vfs\uFF0C\u8FD4\u56DE null\uFF09"
304735
+ "AudioClip \u8D44\u4EA7\u5F15\u7528:vfs \u7EDD\u5BF9\u8DEF\u5F84,**\u5FC5\u5E26\u7269\u7406\u6587\u4EF6\u540E\u7F00**(.mp3/.wav/.ogg),\u5982 /Audio/click.mp3(output \u4E2D\u82E5\u5F15\u7528 builtin \u8D44\u4EA7\u6216\u4E0D\u5728 vfs,\u8FD4\u56DE null)"
304616
304736
  ),
304617
304737
  volume: external_exports.number().optional(),
304618
304738
  loop: external_exports.boolean().optional(),
@@ -305072,7 +305192,9 @@ var init_schema23 = __esm({
305072
305192
  particleRendererAddInputSchema = external_exports.object({
305073
305193
  entityId: external_exports.string().describe("\u76EE\u6807\u5B9E\u4F53 ID"),
305074
305194
  renderMode: particleRenderModeEnum.optional().describe("\u6E32\u67D3\u6A21\u5F0F,\u9ED8\u8BA4 Billboard"),
305075
- material: external_exports.string().optional().describe("\u7C92\u5B50\u6750\u8D28\u8D44\u4EA7 vfs \u7EDD\u5BF9\u8DEF\u5F84,\u5982 /Materials/fire_particle\u3002\u7701\u7565\u5219\u7528\u5F15\u64CE\u5185\u7F6E\u9ED8\u8BA4\u6750\u8D28\u3002"),
305195
+ material: external_exports.string().optional().describe(
305196
+ "\u7C92\u5B50\u6750\u8D28\u8D44\u4EA7 vfs \u7EDD\u5BF9\u8DEF\u5F84,**\u5FC5\u5E26 .mat \u540E\u7F00**,\u5982 /Materials/fire_particle.mat\u3002\u7701\u7565\u5219\u7528\u5F15\u64CE\u5185\u7F6E\u9ED8\u8BA4\u6750\u8D28\u3002"
305197
+ ),
305076
305198
  mesh: external_exports.string().optional().describe("\u7C92\u5B50\u7F51\u683C\u8D44\u4EA7 vfs \u7EDD\u5BF9\u8DEF\u5F84(\u4EC5 renderMode=Mesh \u65F6\u751F\u6548);\u7701\u7565\u5219\u7528\u9ED8\u8BA4 quad"),
305077
305199
  main: particleMainModuleSchema.optional().describe("\u4E3B\u6A21\u5757(duration/lifetime/speed/size/color/maxParticles)"),
305078
305200
  emission: particleEmissionModuleSchema.optional().describe("\u53D1\u5C04\u6A21\u5757(rate/shape)"),
@@ -305289,7 +305411,7 @@ var init_schema24 = __esm({
305289
305411
  init_enum_maps();
305290
305412
  spriteDrawModeEnum = external_exports.enum(["Simple", "Sliced", "Tiled"]).describe("\u7ED8\u5236\u6A21\u5F0F;Simple=\u6574\u4F53\u7F29\u653E(\u9ED8\u8BA4),Sliced=\u4E5D\u5BAB\u683C,Tiled=\u6309 border \u5E73\u94FA");
305291
305413
  spriteTileModeEnum = external_exports.enum(["Continuous", "Adaptive"]).describe("\u5E73\u94FA\u6A21\u5F0F(drawMode=Tiled \u65F6\u751F\u6548);Continuous=\u8FDE\u7EED(\u9ED8\u8BA4),Adaptive=\u6574\u6570\u5E73\u94FA");
305292
- SPRITE_REF_DESC = "Sprite \u8D44\u4EA7 vfs \u7EDD\u5BF9\u8DEF\u5F84,\u5982 /Sprites/player_idle\u3002\u26A0\uFE0F \u4E0D\u80FD\u76F4\u63A5\u4F20 Texture \u8DEF\u5F84(\u5982 /Textures/player.png \u4F1A\u663E\u793A\u7A7A\u767D)\u3002Sprite \u662F Texture \u7684\u5305\u88C5,\u9700\u5148 `sprite.create({ name, texture: '/Textures/player.png' })` \u521B\u5EFA,\u518D\u4F20 Sprite path\u3002\u5B8C\u6574\u5DE5\u4F5C\u6D41:texture.create \u2192 sprite.create \u2192 spriteRenderer.add";
305414
+ SPRITE_REF_DESC = "Sprite \u8D44\u4EA7 vfs \u7EDD\u5BF9\u8DEF\u5F84,**\u5FC5\u5E26 .sprite \u540E\u7F00**,\u5982 /Sprites/player_idle.sprite\u3002\u26A0\uFE0F \u4E0D\u80FD\u76F4\u63A5\u4F20 Texture \u8DEF\u5F84(\u5982 /Textures/player.png \u4F1A\u663E\u793A\u7A7A\u767D)\u3002Sprite \u662F Texture \u7684\u5305\u88C5,\u9700\u5148 `sprite.create({ name, texture: '/Textures/player.png' })` \u521B\u5EFA,\u518D\u4F20 Sprite path\u3002\u5B8C\u6574\u5DE5\u4F5C\u6D41:texture.create \u2192 sprite.create \u2192 spriteRenderer.add";
305293
305415
  spriteRendererPropsSchema = external_exports.object({
305294
305416
  sprite: external_exports.string().nullable().optional().describe(SPRITE_REF_DESC),
305295
305417
  color: colorSchema.optional().describe("\u53E0\u52A0\u989C\u8272,\u9ED8\u8BA4\u767D\u8272"),
@@ -305513,7 +305635,7 @@ var init_schema25 = __esm({
305513
305635
  textVerticalAlignmentEnum2 = external_exports.enum(["Top", "Center", "Bottom"]).describe("\u5782\u76F4\u5BF9\u9F50");
305514
305636
  fontStyleEnum2 = external_exports.enum(["None", "Bold", "Italic"]).describe("\u5B57\u4F53\u6837\u5F0F");
305515
305637
  overflowModeEnum = external_exports.enum(["Overflow", "Truncate"]).describe("\u6EA2\u51FA\u5904\u7406;Overflow=\u6EA2\u51FA(\u9ED8\u8BA4),Truncate=\u88C1\u526A");
305516
- FONT_REF_DESC = "\u5B57\u4F53\u8D44\u4EA7\u5F15\u7528:vfs \u7EDD\u5BF9\u8DEF\u5F84,\u5982 /Fonts/Main\u3002\u7701\u7565\u5219\u7528\u5F15\u64CE\u9ED8\u8BA4\u5B57\u4F53\u3002";
305638
+ FONT_REF_DESC = "\u5B57\u4F53\u8D44\u4EA7\u5F15\u7528:vfs \u7EDD\u5BF9\u8DEF\u5F84,**\u5FC5\u5E26\u7269\u7406\u6587\u4EF6\u540E\u7F00**(.ttf/.otf/.woff),\u5982 /Fonts/Main.ttf\u3002\u7701\u7565\u5219\u7528\u5F15\u64CE\u9ED8\u8BA4\u5B57\u4F53\u3002";
305517
305639
  textRendererPropsSchema = external_exports.object({
305518
305640
  text: external_exports.string().optional().describe("\u6587\u672C\u5185\u5BB9"),
305519
305641
  color: colorSchema.optional().describe("\u6587\u5B57\u989C\u8272"),
@@ -305855,7 +305977,39 @@ var init_project = __esm({
305855
305977
  });
305856
305978
 
305857
305979
  // ../editor-api/src/tools/scene/create.ts
305858
- var sceneCreateInputSchema, sceneCreate;
305980
+ function collectSceneEntities(asset3) {
305981
+ let raw;
305982
+ try {
305983
+ raw = asset3.getMainData?.();
305984
+ } catch (err2) {
305985
+ console.warn(`[scene.create] getMainData failed, entities=[]:`, err2);
305986
+ return [];
305987
+ }
305988
+ if (typeof raw !== "string")
305989
+ return [];
305990
+ let parsed;
305991
+ try {
305992
+ parsed = JSON.parse(raw);
305993
+ } catch (err2) {
305994
+ console.warn(`[scene.create] scene file JSON.parse failed, entities=[]:`, err2);
305995
+ return [];
305996
+ }
305997
+ const entitiesArr = parsed.entities ?? [];
305998
+ const childIdToParentId = /* @__PURE__ */ new Map();
305999
+ for (const e6 of entitiesArr) {
306000
+ for (const childId of e6.children ?? []) {
306001
+ childIdToParentId.set(childId, e6.id);
306002
+ }
306003
+ }
306004
+ return entitiesArr.map((e6) => ({
306005
+ id: e6.id,
306006
+ name: e6.name ?? "",
306007
+ parentId: childIdToParentId.get(e6.id) ?? null,
306008
+ isActive: e6.isActive ?? true,
306009
+ layer: e6.layer
306010
+ }));
306011
+ }
306012
+ var sceneCreateInputSchema, sceneCreateOutputSchema, sceneCreate;
305859
306013
  var init_create15 = __esm({
305860
306014
  "../editor-api/src/tools/scene/create.ts"() {
305861
306015
  "use strict";
@@ -305866,15 +306020,21 @@ var init_create15 = __esm({
305866
306020
  init_helpers();
305867
306021
  sceneCreateInputSchema = external_exports.object({
305868
306022
  name: external_exports.string().min(1).max(128).describe("\u573A\u666F\u540D\u79F0"),
305869
- folder: external_exports.string().optional().describe("\u76EE\u6807\u6587\u4EF6\u5939 vfs \u8DEF\u5F84\uFF0C\u7701\u7565\u5219\u521B\u5EFA\u5728\u6839\u76EE\u5F55")
306023
+ folder: external_exports.string().optional().describe(FOLDER_PARAM_DESCRIPTION)
306024
+ });
306025
+ sceneCreateOutputSchema = assetInfoSchema.extend({
306026
+ entities: external_exports.array(entityInfoSchema).optional().describe(
306027
+ "\u65B0\u5EFA\u573A\u666F\u91CC\u7684 entity \u5217\u8868(\u7ED3\u6784\u8DDF entity.find \u8F93\u51FA\u4E00\u81F4)\u3002\u5F15\u64CE\u521D\u59CB\u5316\u65B0\u573A\u666F\u65F6\u901A\u5E38\u4F1A\u6CE8\u5165 \u82E5\u5E72\u9ED8\u8BA4 entity(\u5982 Camera / DirectLight)\u2014 \u8FD9\u4E9B\u5C31\u662F\u573A\u666F\u7684\u73B0\u6709 entity,\u4E0D\u662F\u4E34\u65F6\u6A21\u677F\u3002"
306028
+ )
305870
306029
  });
305871
306030
  sceneCreate = defineTool({
305872
306031
  id: "scene.create",
305873
- description: "\u521B\u5EFA\u573A\u666F\u8D44\u4EA7\u3002\u9ED8\u8BA4\u573A\u666F\u5185\u5BB9\uFF08Camera + DirectLight\uFF09\u7531\u5F15\u64CE\u81EA\u52A8\u751F\u6210\u3002",
306032
+ description: "\u521B\u5EFA\u573A\u666F\u8D44\u4EA7\u6587\u4EF6\u3002\u4E0D\u4F1A\u5207\u6362\u5F53\u524D\u7F16\u8F91\u573A\u666F \u2014 \u540E\u7EED entity.create / component.add \u9ED8\u8BA4\u8FDB\u5165 active scene\u3002\u8981\u5728\u65B0\u573A\u666F\u5185\u642D\u5EFA,\u63A5\u7740\u8C03 scene.setActive(<\u8FD4\u56DE\u7684 path>)\u3002\u53EF\u8C03 scene.getActive \u67E5\u8BE2\u5F53\u524D\u6FC0\u6D3B\u573A\u666F\u3002\u65B0\u573A\u666F**\u901A\u5E38\u5DF2\u542B\u82E5\u5E72\u9ED8\u8BA4 entity**(\u5982 Camera / DirectLight),\u901A\u8FC7 output.entities \u67E5\u770B \u2014 \u5982\u4F55\u5904\u7406(\u590D\u7528 / \u5220\u9664 / \u5FFD\u7565)\u7531\u4F60\u6839\u636E\u4EFB\u52A1\u4E0A\u4E0B\u6587\u81EA\u884C\u51B3\u5B9A\u3002",
305874
306033
  input: sceneCreateInputSchema,
305875
- output: assetInfoSchema,
306034
+ output: sceneCreateOutputSchema,
305876
306035
  handler: async (params, ctx) => {
305877
306036
  const folderUuid = validateFolderIdParam(params.folder, ctx);
306037
+ assertAssetNameAvailable(params.name, folderUuid ?? null, "Scene", ctx);
305878
306038
  const asset3 = await ctx.assetFacade.createAssetByAdd({
305879
306039
  assetType: "Scene",
305880
306040
  name: params.name,
@@ -305884,7 +306044,42 @@ var init_create15 = __esm({
305884
306044
  throw new EditorAPIError("OPERATION_FAILED", "\u521B\u5EFA\u573A\u666F\u5931\u8D25");
305885
306045
  }
305886
306046
  await asset3.ensureReady();
305887
- return resolveAssetSnapshot(asset3.id, ctx);
306047
+ const snapshot = await resolveAssetSnapshot(asset3.id, ctx);
306048
+ return {
306049
+ path: snapshot.path,
306050
+ name: snapshot.name,
306051
+ type: snapshot.type,
306052
+ entities: collectSceneEntities(asset3)
306053
+ };
306054
+ }
306055
+ });
306056
+ }
306057
+ });
306058
+
306059
+ // ../editor-api/src/tools/scene/get-active.ts
306060
+ var sceneGetActiveInputSchema, sceneGetActiveOutputSchema, sceneGetActive;
306061
+ var init_get_active = __esm({
306062
+ "../editor-api/src/tools/scene/get-active.ts"() {
306063
+ "use strict";
306064
+ init_zod();
306065
+ init_define();
306066
+ init_helpers();
306067
+ sceneGetActiveInputSchema = external_exports.object({});
306068
+ sceneGetActiveOutputSchema = external_exports.object({
306069
+ activeScenePath: external_exports.string().nullable().describe(
306070
+ "\u5F53\u524D\u6FC0\u6D3B\u7684\u7F16\u8F91\u573A\u666F vfs \u7EDD\u5BF9\u8DEF\u5F84\u3002null \u8868\u793A\u65E0\u6FC0\u6D3B\u573A\u666F\u3002entity.create / component.add \u7B49\u64CD\u4F5C\u9ED8\u8BA4\u8FDB\u5165\u6B64\u573A\u666F\u3002"
306071
+ )
306072
+ });
306073
+ sceneGetActive = defineTool({
306074
+ id: "scene.getActive",
306075
+ description: "\u67E5\u8BE2\u5F53\u524D\u6FC0\u6D3B\u7684\u7F16\u8F91\u573A\u666F\u8DEF\u5F84\u3002",
306076
+ input: sceneGetActiveInputSchema,
306077
+ output: sceneGetActiveOutputSchema,
306078
+ handler: async (_26, ctx) => {
306079
+ const sceneId = ctx.rootStore.currentSceneId;
306080
+ return {
306081
+ activeScenePath: sceneId ? getAssetPath(sceneId, ctx) : null
306082
+ };
305888
306083
  }
305889
306084
  });
305890
306085
  }
@@ -305900,15 +306095,14 @@ var init_set_active = __esm({
305900
306095
  init_errors3();
305901
306096
  init_helpers();
305902
306097
  sceneSetActiveInputSchema = external_exports.object({
305903
- scene: external_exports.string().min(1).describe("\u76EE\u6807 Scene \u8D44\u4EA7 vfs \u8DEF\u5F84,\u5982 /Scenes/main")
306098
+ scene: external_exports.string().min(1).describe("\u76EE\u6807 Scene \u8D44\u4EA7 vfs \u8DEF\u5F84,**\u5FC5\u5E26 .scene \u540E\u7F00**,\u5982 /Scenes/main.scene")
305904
306099
  });
305905
306100
  sceneSetActiveOutputSchema = external_exports.object({
305906
- activeScenePath: external_exports.string().nullable().describe("\u5F53\u524D\u6FC0\u6D3B\u7684\u573A\u666F vfs \u7EDD\u5BF9\u8DEF\u5F84"),
305907
- entityCount: external_exports.number().int()
306101
+ activeScenePath: external_exports.string().nullable().describe("\u5207\u6362\u540E\u5F53\u524D\u6FC0\u6D3B\u7684\u573A\u666F vfs \u7EDD\u5BF9\u8DEF\u5F84")
305908
306102
  });
305909
306103
  sceneSetActive = defineTool({
305910
306104
  id: "scene.setActive",
305911
- description: "\u5207\u6362\u5F53\u524D\u7F16\u8F91\u573A\u666F\u3002Headless \u901A\u8FC7 asset.content \u5E8F\u5217\u5316/\u53CD\u5E8F\u5217\u5316\u505A scene swap;Browser \u901A\u8FC7 EditorScene \u91CD\u5EFA + EngineProjection.setScene \u505A\u5207\u6362\u3002\u4E24\u6761\u8DEF\u5F84\u7531 root \u81EA\u5DF1\u5B9E\u73B0,handler \u5E73\u53F0\u65E0\u5173\u3002",
306105
+ description: "\u5207\u6362\u5F53\u524D\u7F16\u8F91\u573A\u666F\u3002\u540E\u7EED entity.create / component.add \u7B49\u64CD\u4F5C\u9ED8\u8BA4\u8FDB\u5165\u6B64\u573A\u666F\u3002\u5178\u578B\u4F7F\u7528:scene.create \u521B\u5EFA\u65B0\u573A\u666F\u6587\u4EF6\u540E\u8C03\u7528\u6B64\u5DE5\u5177\u5207\u6362\u8FC7\u53BB,\u518D\u5F00\u59CB\u642D\u5EFA\u573A\u666F\u5185\u5BB9\u3002",
305912
306106
  input: sceneSetActiveInputSchema,
305913
306107
  output: sceneSetActiveOutputSchema,
305914
306108
  handler: async (params, ctx) => {
@@ -305938,8 +306132,7 @@ var init_set_active = __esm({
305938
306132
  );
305939
306133
  }
305940
306134
  return {
305941
- activeScenePath: getAssetPath(sceneUuid, ctx),
305942
- entityCount: Object.keys(root3.domainStore.state.entities ?? {}).length
306135
+ activeScenePath: getAssetPath(sceneUuid, ctx)
305943
306136
  };
305944
306137
  }
305945
306138
  });
@@ -305995,8 +306188,8 @@ var init_background = __esm({
305995
306188
  sceneSetBackgroundInputSchema = external_exports.object({
305996
306189
  mode: backgroundModeSchema.optional().describe("\u80CC\u666F\u6A21\u5F0F\uFF1ASolidColor\uFF08\u7EAF\u8272\uFF09\u3001Sky\uFF08\u5929\u7A7A\u76D2\uFF09\u3001Texture\uFF08\u7EB9\u7406\uFF09"),
305997
306190
  color: colorSchema.optional().describe("\u80CC\u666F\u989C\u8272\uFF08\u4EC5 SolidColor \u6A21\u5F0F\u6709\u6548\uFF09"),
305998
- texture: external_exports.string().optional().describe("\u80CC\u666F\u7EB9\u7406\u8D44\u4EA7 vfs \u8DEF\u5F84\uFF08\u4EC5 Texture \u6A21\u5F0F\u6709\u6548\uFF09\uFF0C\u5982 /Textures/bg"),
305999
- skyMaterial: external_exports.string().optional().describe("\u5929\u7A7A\u6750\u8D28\u8D44\u4EA7 vfs \u8DEF\u5F84\uFF08\u4EC5 Sky \u6A21\u5F0F\u6709\u6548\uFF09\uFF0C\u5982 /Materials/sky")
306191
+ texture: external_exports.string().optional().describe("\u80CC\u666F\u7EB9\u7406\u8D44\u4EA7 vfs \u8DEF\u5F84(\u4EC5 Texture \u6A21\u5F0F\u6709\u6548),**\u5FC5\u5E26\u7269\u7406\u6587\u4EF6\u540E\u7F00**(.png/.jpg/.hdr),\u5982 /Textures/bg.png"),
306192
+ skyMaterial: external_exports.string().optional().describe("\u5929\u7A7A\u6750\u8D28\u8D44\u4EA7 vfs \u8DEF\u5F84(\u4EC5 Sky \u6A21\u5F0F\u6709\u6548),**\u5FC5\u5E26 .mat \u540E\u7F00**,\u5982 /Materials/sky.mat")
306000
306193
  }).refine((val) => !(val.skyMaterial !== void 0 && val.mode !== "Sky"), {
306001
306194
  message: "skyMaterial \u4EC5\u5728 mode='Sky' \u65F6\u5141\u8BB8\u4F20\u5165",
306002
306195
  path: ["skyMaterial"]
@@ -306354,9 +306547,11 @@ var init_scene = __esm({
306354
306547
  "../editor-api/src/tools/scene/index.ts"() {
306355
306548
  "use strict";
306356
306549
  init_create15();
306550
+ init_get_active();
306357
306551
  init_set_active();
306358
306552
  init_update14();
306359
306553
  init_create15();
306554
+ init_get_active();
306360
306555
  init_set_active();
306361
306556
  init_update14();
306362
306557
  init_background();
@@ -306364,7 +306559,7 @@ var init_scene = __esm({
306364
306559
  init_shadow();
306365
306560
  init_fog();
306366
306561
  init_ambient_occlusion();
306367
- sceneTools = [sceneCreate, sceneSetActive, sceneUpdate];
306562
+ sceneTools = [sceneCreate, sceneGetActive, sceneSetActive, sceneUpdate];
306368
306563
  }
306369
306564
  });
306370
306565
 
@@ -310118,7 +310313,20 @@ __export(execute_code_exports, {
310118
310313
  EXECUTE_TOOL_NAME: () => EXECUTE_TOOL_NAME,
310119
310314
  executeCode: () => executeCode
310120
310315
  });
310121
- async function executeCode(code, invoke2, formatRuntimeError) {
310316
+ function defaultFormatRuntimeError(raw, ops2) {
310317
+ const okOps = ops2.filter((op) => op.ok);
310318
+ if (okOps.length === 0)
310319
+ return raw;
310320
+ const sample2 = okOps.slice(0, 5).map((op) => ` \u2713 ${op.toolId}`).join("\n");
310321
+ const more = okOps.length > 5 ? `
310322
+ ... \u5171 ${okOps.length} \u4E2A\u6210\u529F\u64CD\u4F5C` : "";
310323
+ return `${raw}
310324
+
310325
+ \u26A0 \u672C\u6B21 execute \u5931\u8D25\u524D\u5DF2\u6210\u529F\u6267\u884C ${okOps.length} \u4E2A\u64CD\u4F5C(\u8BE6\u89C1 partialSuccessOps):
310326
+ ${sample2}${more}
310327
+ \u91CD\u65B0 execute \u65F6\u8BF7**\u53EA\u8865\u5931\u8D25\u7684\u6B65\u9AA4,\u4E0D\u8981\u91CD\u590D\u5DF2\u6210\u529F\u7684\u64CD\u4F5C** \u2014 \u591A\u6570 *.create \u5DE5\u5177\u4E0D\u5E42\u7B49,\u91CD\u590D\u8C03\u7528\u4F1A\u521B\u5EFA\u540C\u540D\u5B64\u513F\u8D44\u4EA7\u3002`;
310328
+ }
310329
+ async function executeCode(code, invoke2, formatRuntimeError = defaultFormatRuntimeError) {
310122
310330
  const ops2 = [];
310123
310331
  const api3 = {
310124
310332
  async invoke(toolId, payload) {
@@ -310153,7 +310361,7 @@ ${code}`);
310153
310361
  const partialSuccessOps = ops2.filter((op) => op.ok);
310154
310362
  return {
310155
310363
  success: false,
310156
- error: formatRuntimeError ? formatRuntimeError(raw, ops2) : raw,
310364
+ error: formatRuntimeError(raw, ops2),
310157
310365
  phase: "runtime",
310158
310366
  ops: ops2,
310159
310367
  partialSuccessOps: partialSuccessOps.length > 0 ? partialSuccessOps : void 0
@@ -310197,7 +310405,7 @@ var init_cli_helpers = __esm({
310197
310405
 
310198
310406
  // src/push-output.ts
310199
310407
  function printPushResult(result2, options = {}) {
310200
- const { log: log10 = console.log, showNoChanges = true } = options;
310408
+ const { log: log10 = console.log, warn: warn2 = console.warn, showNoChanges = true } = options;
310201
310409
  let hasOutput = false;
310202
310410
  if (result2.pushed.length > 0) {
310203
310411
  hasOutput = true;
@@ -310211,6 +310419,8 @@ function printPushResult(result2, options = {}) {
310211
310419
  }
310212
310420
  if (result2.warnings.length > 0) {
310213
310421
  hasOutput = true;
310422
+ for (const warning of result2.warnings)
310423
+ warn2(warning);
310214
310424
  log10(`Completed with ${result2.warnings.length} warning(s). Check stderr for details.`);
310215
310425
  }
310216
310426
  if (!hasOutput && showNoChanges) {
@@ -446247,6 +446457,82 @@ var init_collectAssetReferenceIds = __esm({
446247
446457
  }
446248
446458
  });
446249
446459
 
446460
+ // ../model/src/modules/assets/viewer/ThumbnailRegistry.ts
446461
+ function getRegisteredThumbnail(type) {
446462
+ return thumbnailItems[type];
446463
+ }
446464
+ function getRegisteredThumbnails() {
446465
+ return thumbnailItems;
446466
+ }
446467
+ function registerThumbnail(type, item) {
446468
+ thumbnailItems[type] = item;
446469
+ }
446470
+ var thumbnailItems;
446471
+ var init_ThumbnailRegistry = __esm({
446472
+ "../model/src/modules/assets/viewer/ThumbnailRegistry.ts"() {
446473
+ "use strict";
446474
+ thumbnailItems = {};
446475
+ }
446476
+ });
446477
+
446478
+ // ../model/src/modules/assets/viewer/ViewerRegistry.ts
446479
+ function getRegisteredViewer(type) {
446480
+ return assetViewers.get(type);
446481
+ }
446482
+ function registerViewer(type, viewer) {
446483
+ assetViewers.set(type, viewer);
446484
+ }
446485
+ var assetViewers;
446486
+ var init_ViewerRegistry = __esm({
446487
+ "../model/src/modules/assets/viewer/ViewerRegistry.ts"() {
446488
+ "use strict";
446489
+ assetViewers = /* @__PURE__ */ new Map();
446490
+ }
446491
+ });
446492
+
446493
+ // ../model/src/modules/assets/decorators/PluginAsset.ts
446494
+ function ensureUploadMainFile(main3, fallbackName = "upload.bin") {
446495
+ if (main3 instanceof File) {
446496
+ return main3;
446497
+ }
446498
+ return new File([main3], fallbackName, {
446499
+ type: main3.type || "application/octet-stream"
446500
+ });
446501
+ }
446502
+ function asset(options) {
446503
+ return (target) => {
446504
+ assetLogger.info("register", options.type, "verbose");
446505
+ let iconFallback = "icon-file-unknown";
446506
+ if (typeof options.icon === "string") {
446507
+ iconFallback = options.icon;
446508
+ options.icon = void 0;
446509
+ } else if (options?.icon?.fallback) {
446510
+ iconFallback = options.icon.fallback;
446511
+ }
446512
+ EditorAsset.registerAssetMeta(target, { ...options, targetConstructor: target });
446513
+ if (options.viewer) {
446514
+ registerViewer(options.type, new options.viewer());
446515
+ }
446516
+ if (options.thumbnail) {
446517
+ registerThumbnail(options.type, options.thumbnail);
446518
+ }
446519
+ if (options.dragLayer) {
446520
+ target.dragLayer = options.dragLayer;
446521
+ }
446522
+ };
446523
+ }
446524
+ var assetLogger;
446525
+ var init_PluginAsset = __esm({
446526
+ "../model/src/modules/assets/decorators/PluginAsset.ts"() {
446527
+ "use strict";
446528
+ init_src4();
446529
+ init_EditorAsset();
446530
+ init_ThumbnailRegistry();
446531
+ init_ViewerRegistry();
446532
+ assetLogger = logger("Plugin Asset");
446533
+ }
446534
+ });
446535
+
446250
446536
  // ../model/src/modules/assets/DragDropMixin.ts
446251
446537
  var DEFAULT_SCENE_ID2, DragDropMixin;
446252
446538
  var init_DragDropMixin = __esm({
@@ -513985,21 +514271,6 @@ var init_OrbitControl = __esm({
513985
514271
  }
513986
514272
  });
513987
514273
 
513988
- // ../model/src/modules/assets/viewer/ViewerRegistry.ts
513989
- function getRegisteredViewer(type) {
513990
- return assetViewers.get(type);
513991
- }
513992
- function registerViewer(type, viewer) {
513993
- assetViewers.set(type, viewer);
513994
- }
513995
- var assetViewers;
513996
- var init_ViewerRegistry = __esm({
513997
- "../model/src/modules/assets/viewer/ViewerRegistry.ts"() {
513998
- "use strict";
513999
- assetViewers = /* @__PURE__ */ new Map();
514000
- }
514001
- });
514002
-
514003
514274
  // ../model/src/modules/assets/viewer/ViewerManager.ts
514004
514275
  var import_mobx3, ViewerManager;
514005
514276
  var init_ViewerManager = __esm({
@@ -514317,24 +514588,6 @@ var init_CanvasRenderer = __esm({
514317
514588
  }
514318
514589
  });
514319
514590
 
514320
- // ../model/src/modules/assets/viewer/ThumbnailRegistry.ts
514321
- function getRegisteredThumbnail(type) {
514322
- return thumbnailItems[type];
514323
- }
514324
- function getRegisteredThumbnails() {
514325
- return thumbnailItems;
514326
- }
514327
- function registerThumbnail(type, item) {
514328
- thumbnailItems[type] = item;
514329
- }
514330
- var thumbnailItems;
514331
- var init_ThumbnailRegistry = __esm({
514332
- "../model/src/modules/assets/viewer/ThumbnailRegistry.ts"() {
514333
- "use strict";
514334
- thumbnailItems = {};
514335
- }
514336
- });
514337
-
514338
514591
  // ../model/src/modules/assets/viewer/ThumbnailMixin.ts
514339
514592
  var import_mobx4, pixelRatio, pixelWidth, pixelHeight, assetIconMap, _ThumbnailMixin, ThumbnailMixin;
514340
514593
  var init_ThumbnailMixin = __esm({
@@ -515343,16 +515596,18 @@ var init_EngineObjectProxy = __esm({
515343
515596
  });
515344
515597
 
515345
515598
  // ../model/src/modules/assets/EditorAsset.ts
515346
- var import_mobx7, assetLogger, assetIconMap2, _EditorAsset, EditorAsset;
515599
+ var import_mobx7, assetLogger2, assetIconMap2, _EditorAsset, EditorAsset;
515347
515600
  var init_EditorAsset = __esm({
515348
515601
  "../model/src/modules/assets/EditorAsset.ts"() {
515349
515602
  "use strict";
515350
515603
  import_mobx7 = __toESM(require_dist());
515604
+ init_src();
515351
515605
  init_src3();
515352
515606
  init_src4();
515353
515607
  init_Main();
515354
515608
  init_Meta();
515355
515609
  init_collectAssetReferenceIds();
515610
+ init_PluginAsset();
515356
515611
  init_DragDropMixin();
515357
515612
  init_ThumbnailMixin();
515358
515613
  init_ViewerRegistry();
@@ -515361,7 +515616,7 @@ var init_EditorAsset = __esm({
515361
515616
  init_trace2();
515362
515617
  init_decorators();
515363
515618
  init_EngineObjectProxy();
515364
- assetLogger = logger("EditorAsset", "Asset", true);
515619
+ assetLogger2 = logger("EditorAsset", "Asset", true);
515365
515620
  assetIconMap2 = {
515366
515621
  Scene: "https://mdn.alipayobjects.com/huamei_dc3kgb/afts/img/A*Z36ZQ4DCa58AAAAAAAAAAAAADuiaAQ/original",
515367
515622
  script: "https://mdn.alipayobjects.com/huamei_dc3kgb/afts/img/A*rMekSIWSS4oAAAAAAAAAAAAADuiaAQ/original",
@@ -515688,7 +515943,7 @@ var init_EditorAsset = __esm({
515688
515943
  try {
515689
515944
  await this.collectDependencies();
515690
515945
  } catch (error49) {
515691
- assetLogger.warn(`Failed to collect dependencies for asset ${this.name}:`, error49);
515946
+ assetLogger2.warn(`Failed to collect dependencies for asset ${this.name}:`, error49);
515692
515947
  }
515693
515948
  } else {
515694
515949
  await this._gate.hydrate(async () => {
@@ -515968,15 +516223,38 @@ var init_EditorAsset = __esm({
515968
516223
  return temp;
515969
516224
  }
515970
516225
  /**
515971
- * @param withFileName false if you want the directory path
516226
+ * @param withFileName false 返回目录路径
516227
+ *
516228
+ * 拼接 extname 规则(第一性:判定"是否已经带正确的类型 ext",不是"是否含 dot"):
516229
+ * - builtin 资产(BUILTIN_REMOTE_ASSET_UUIDS)→ 永不加 ext(跨版本数据契约)
516230
+ * - 类型未注册 extname(自由扩展类型如 .ts/.md)→ 原样返回(name 自带后缀如 `foo.ts`)
516231
+ * - **upload-based 类型**(Font/Texture/Audio/glTF/Spine 等 importMenuConfig.type 含 Upload)→
516232
+ * 原样返回 fileName。upload-based 资产 vfs 落地形态本身就带物理后缀(`MyFont.ttf` / `tex.png`),
516233
+ * 再追加 typed extname 会产生双重后缀(`MyFont.ttf.font`)→ 破坏 vfs lookup + textRenderer.font 引用。
516234
+ * - name 已以 `.{extname}` 结尾 → 原样返回(避免 `foo.mat` → `foo.mat.mat`)
516235
+ * - 否则 → 拼 `.{extname}`(`start` → `start.scene`、`ground.v1` → `ground.v1.mat`)
515972
516236
  */
515973
516237
  getRouteString(withFileName = true) {
515974
516238
  const routes = this.getTempRoutes();
515975
516239
  const filepath = routes.length > 0 ? "/" + routes.join("/") + "/" : "/";
515976
- if (withFileName) {
515977
- return filepath + this._name;
516240
+ if (!withFileName)
516241
+ return filepath;
516242
+ const fileName = this._name;
516243
+ if (BUILTIN_REMOTE_ASSET_UUIDS.has(this.id)) {
516244
+ return filepath + fileName;
516245
+ }
516246
+ const config2 = this.getMetaConfig();
516247
+ const extname5 = config2?.extname;
516248
+ if (!extname5)
516249
+ return filepath + fileName;
516250
+ const importType = config2?.importMenuConfig?.type;
516251
+ if (typeof importType === "number" && (importType & 2 /* Upload */) !== 0) {
516252
+ return filepath + fileName;
515978
516253
  }
515979
- return filepath;
516254
+ if (fileName.endsWith(`.${extname5}`)) {
516255
+ return filepath + fileName;
516256
+ }
516257
+ return filepath + `${fileName}.${extname5}`;
515980
516258
  }
515981
516259
  /**
515982
516260
  * 获取当前资产的 Ref 对象
@@ -516093,14 +516371,14 @@ var init_EditorAsset = __esm({
516093
516371
  try {
516094
516372
  parsedContent = JSON.parse(fileContent);
516095
516373
  } catch (error49) {
516096
- assetLogger.warn(
516374
+ assetLogger2.warn(
516097
516375
  `Asset ${this.name} main file is not JSON, skipping content dependency collection`,
516098
516376
  "verbose"
516099
516377
  );
516100
516378
  }
516101
516379
  collectRefs(parsedContent).forEach((refId) => this._dependsOnAssetIds.add(refId));
516102
516380
  } catch (error49) {
516103
- assetLogger.error(`Failed to collect dependencies from main file for asset ${this.name}:`, error49, "verbose");
516381
+ assetLogger2.error(`Failed to collect dependencies from main file for asset ${this.name}:`, error49, "verbose");
516104
516382
  }
516105
516383
  }
516106
516384
  this._updateDependedByRelations();
@@ -516206,7 +516484,7 @@ var init_EditorAsset = __esm({
516206
516484
  */
516207
516485
  setupDependencyListeners() {
516208
516486
  this.onDependencyChanged((event) => {
516209
- assetLogger.info(`Asset ${this.name} received dependency change from ${event.sourceAsset.name}:`, {
516487
+ assetLogger2.info(`Asset ${this.name} received dependency change from ${event.sourceAsset.name}:`, {
516210
516488
  property: event.propertyName,
516211
516489
  oldValue: event.oldValue,
516212
516490
  newValue: event.newValue
@@ -516654,49 +516932,6 @@ var init_ObservableVirtualFileSystem = __esm({
516654
516932
  }
516655
516933
  });
516656
516934
 
516657
- // ../model/src/modules/assets/decorators/PluginAsset.ts
516658
- function ensureUploadMainFile(main3, fallbackName = "upload.bin") {
516659
- if (main3 instanceof File) {
516660
- return main3;
516661
- }
516662
- return new File([main3], fallbackName, {
516663
- type: main3.type || "application/octet-stream"
516664
- });
516665
- }
516666
- function asset(options) {
516667
- return (target) => {
516668
- assetLogger2.info("register", options.type, "verbose");
516669
- let iconFallback = "icon-file-unknown";
516670
- if (typeof options.icon === "string") {
516671
- iconFallback = options.icon;
516672
- options.icon = void 0;
516673
- } else if (options?.icon?.fallback) {
516674
- iconFallback = options.icon.fallback;
516675
- }
516676
- EditorAsset.registerAssetMeta(target, { ...options, targetConstructor: target });
516677
- if (options.viewer) {
516678
- registerViewer(options.type, new options.viewer());
516679
- }
516680
- if (options.thumbnail) {
516681
- registerThumbnail(options.type, options.thumbnail);
516682
- }
516683
- if (options.dragLayer) {
516684
- target.dragLayer = options.dragLayer;
516685
- }
516686
- };
516687
- }
516688
- var assetLogger2;
516689
- var init_PluginAsset = __esm({
516690
- "../model/src/modules/assets/decorators/PluginAsset.ts"() {
516691
- "use strict";
516692
- init_src4();
516693
- init_EditorAsset();
516694
- init_ThumbnailRegistry();
516695
- init_ViewerRegistry();
516696
- assetLogger2 = logger("Plugin Asset");
516697
- }
516698
- });
516699
-
516700
516935
  // ../model/src/modules/assets/createByAddUploadSource.ts
516701
516936
  function createMainBlob(assetName, mainData) {
516702
516937
  if (mainData === null)
@@ -517201,6 +517436,7 @@ var init_AssetManager = __esm({
517201
517436
  init_esm_node();
517202
517437
  init_src();
517203
517438
  init_src3();
517439
+ init_sync_adapter();
517204
517440
  init_src4();
517205
517441
  init_EditorAsset();
517206
517442
  init_ObservableVirtualFileSystem();
@@ -517847,6 +518083,10 @@ var init_AssetManager = __esm({
517847
518083
  }
517848
518084
  return routeNames;
517849
518085
  }
518086
+ /**
518087
+ * Script 在 name 里保留 `.ts`(影响 compiler/loader/IDE)。其他类型 name 是人话,
518088
+ * extname 由 `EditorAsset.getRouteString` 在拼 path 时主动加。
518089
+ */
517850
518090
  normalizeAssetNameByType(assetType, name16) {
517851
518091
  if (assetType !== "script")
517852
518092
  return name16;
@@ -518101,7 +518341,7 @@ var init_AssetManager = __esm({
518101
518341
  this.ensureAssetPathIndexFresh();
518102
518342
  return this._virtualPathByAssetId.get(assetId);
518103
518343
  }
518104
- /** 通过 virtualPath(如 "assets/mat.mat")查找资产 */
518344
+ /** 严格匹配 source-v2 virtualPath; typed VFS 扩展名不是合法 source ref。 */
518105
518345
  getAssetByVirtualPath(virtualPath) {
518106
518346
  this.ensureAssetPathIndexFresh();
518107
518347
  const assetId = this._assetIdByVirtualPath.get(this.normalizeVirtualPathKey(virtualPath));
@@ -518110,24 +518350,51 @@ var init_AssetManager = __esm({
518110
518350
  rebuildAssetPathIndex() {
518111
518351
  this._assetIdByVirtualPath.clear();
518112
518352
  this._virtualPathByAssetId.clear();
518113
- for (const asset3 of BUILTIN_REMOTE_ASSETS) {
518114
- const virtualPath = getBuiltinAssetSourceVirtualPath(asset3.uuid);
518115
- if (virtualPath) {
518116
- this._virtualPathByAssetId.set(asset3.uuid, virtualPath);
518353
+ const tryRegisterAlias = (key2, assetId) => {
518354
+ if (!key2)
518355
+ return;
518356
+ const normalized = this.normalizeVirtualPathKey(key2);
518357
+ if (!normalized)
518358
+ return;
518359
+ if (!this._assetIdByVirtualPath.has(normalized)) {
518360
+ this._assetIdByVirtualPath.set(normalized, assetId);
518117
518361
  }
518118
- }
518362
+ };
518119
518363
  for (const asset3 of Object.values(this.assets)) {
518120
- const route = asset3.getRouteString?.(true);
518121
- if (!route)
518122
- continue;
518123
- const virtualPath = this.normalizeVirtualPathKey(route);
518364
+ const virtualPath = this.getAssetSourceVirtualPath(asset3);
518124
518365
  if (!virtualPath)
518125
518366
  continue;
518126
518367
  this._assetIdByVirtualPath.set(virtualPath, asset3.id);
518127
518368
  this._virtualPathByAssetId.set(asset3.id, virtualPath);
518128
518369
  }
518370
+ for (const asset3 of BUILTIN_REMOTE_ASSETS) {
518371
+ const virtualPath = getBuiltinAssetSourceVirtualPath(asset3.uuid);
518372
+ if (virtualPath) {
518373
+ if (!this._virtualPathByAssetId.has(asset3.uuid)) {
518374
+ this._virtualPathByAssetId.set(asset3.uuid, virtualPath);
518375
+ }
518376
+ tryRegisterAlias(virtualPath, asset3.uuid);
518377
+ }
518378
+ if (asset3.name) {
518379
+ tryRegisterAlias(asset3.name, asset3.uuid);
518380
+ }
518381
+ }
518129
518382
  this._assetPathIndexDirty = false;
518130
518383
  }
518384
+ getAssetSourceVirtualPath(asset3) {
518385
+ const route = asset3.getRouteString?.(true);
518386
+ if (!route)
518387
+ return void 0;
518388
+ const virtualPath = this.normalizeVirtualPathKey(route);
518389
+ if (!virtualPath || BUILTIN_REMOTE_ASSET_UUIDS.has(asset3.id))
518390
+ return virtualPath;
518391
+ const assetType = asset3.getMetaConfig?.()?.type;
518392
+ if (!assetType)
518393
+ return virtualPath;
518394
+ const parts = virtualPath.split("/");
518395
+ parts[parts.length - 1] = assetNameFromPath(virtualPath, assetType);
518396
+ return parts.join("/");
518397
+ }
518131
518398
  invalidateAssetPathIndex() {
518132
518399
  this._assetPathIndexDirty = true;
518133
518400
  }
@@ -529478,13 +529745,13 @@ var init_baseLt = __esm({
529478
529745
  });
529479
529746
 
529480
529747
  // ../../node_modules/lodash-es/lt.js
529481
- var lt, lt_default2;
529748
+ var lt2, lt_default2;
529482
529749
  var init_lt2 = __esm({
529483
529750
  "../../node_modules/lodash-es/lt.js"() {
529484
529751
  init_baseLt();
529485
529752
  init_createRelationalOperation();
529486
- lt = createRelationalOperation_default(baseLt_default);
529487
- lt_default2 = lt;
529753
+ lt2 = createRelationalOperation_default(baseLt_default);
529754
+ lt_default2 = lt2;
529488
529755
  }
529489
529756
  });
529490
529757
 
@@ -563340,7 +563607,7 @@ var require_edge3 = __commonJS({
563340
563607
  const edge = edgeView ? edgeView.cell : null;
563341
563608
  const terminalView = terminalType === "target" ? targetView : sourceView;
563342
563609
  const terminalMagnet = terminalType === "target" ? targetMagnet : sourceMagnet;
563343
- let valid = true;
563610
+ let valid2 = true;
563344
563611
  const doValidate = (validate3) => {
563345
563612
  const sourcePort = terminalType === "source" ? candidateTerminal ? candidateTerminal.port : null : edge ? edge.getSourcePortId() : null;
563346
563613
  const targetPort = terminalType === "target" ? candidateTerminal ? candidateTerminal.port : null : edge ? edge.getTargetPortId() : null;
@@ -563361,47 +563628,47 @@ var require_edge3 = __commonJS({
563361
563628
  if (allowLoop != null) {
563362
563629
  if (typeof allowLoop === "boolean") {
563363
563630
  if (!allowLoop && sourceView === targetView) {
563364
- valid = false;
563631
+ valid2 = false;
563365
563632
  }
563366
563633
  } else {
563367
- valid = doValidate(allowLoop);
563634
+ valid2 = doValidate(allowLoop);
563368
563635
  }
563369
563636
  }
563370
- if (valid && allowPort != null) {
563637
+ if (valid2 && allowPort != null) {
563371
563638
  if (typeof allowPort === "boolean") {
563372
563639
  if (!allowPort && terminalMagnet) {
563373
- valid = false;
563640
+ valid2 = false;
563374
563641
  }
563375
563642
  } else {
563376
- valid = doValidate(allowPort);
563643
+ valid2 = doValidate(allowPort);
563377
563644
  }
563378
563645
  }
563379
- if (valid && allowEdge != null) {
563646
+ if (valid2 && allowEdge != null) {
563380
563647
  if (typeof allowEdge === "boolean") {
563381
563648
  if (!allowEdge && _EdgeView.isEdgeView(terminalView)) {
563382
- valid = false;
563649
+ valid2 = false;
563383
563650
  }
563384
563651
  } else {
563385
- valid = doValidate(allowEdge);
563652
+ valid2 = doValidate(allowEdge);
563386
563653
  }
563387
563654
  }
563388
- if (valid && allowNode != null && terminalMagnet == null) {
563655
+ if (valid2 && allowNode != null && terminalMagnet == null) {
563389
563656
  if (typeof allowNode === "boolean") {
563390
563657
  if (!allowNode && node_1.NodeView.isNodeView(terminalView)) {
563391
- valid = false;
563658
+ valid2 = false;
563392
563659
  }
563393
563660
  } else {
563394
- valid = doValidate(allowNode);
563661
+ valid2 = doValidate(allowNode);
563395
563662
  }
563396
563663
  }
563397
- if (valid && allowMulti != null && edgeView) {
563664
+ if (valid2 && allowMulti != null && edgeView) {
563398
563665
  const edge2 = edgeView.cell;
563399
563666
  const source = terminalType === "source" ? candidateTerminal : edge2.getSource();
563400
563667
  const target = terminalType === "target" ? candidateTerminal : edge2.getTarget();
563401
563668
  const terminalCell = candidateTerminal ? this.graph.getCellById(candidateTerminal.cell) : null;
563402
563669
  if (source && target && source.cell && target.cell && terminalCell) {
563403
563670
  if (typeof allowMulti === "function") {
563404
- valid = doValidate(allowMulti);
563671
+ valid2 = doValidate(allowMulti);
563405
563672
  } else {
563406
563673
  const connectedEdges = this.graph.model.getConnectedEdges(terminalCell, {
563407
563674
  outgoing: terminalType === "source",
@@ -563415,7 +563682,7 @@ var require_edge3 = __commonJS({
563415
563682
  return s5 && t8 && s5.cell === source.cell && t8.cell === target.cell && s5.port != null && s5.port === source.port && t8.port != null && t8.port === target.port;
563416
563683
  });
563417
563684
  if (exist) {
563418
- valid = false;
563685
+ valid2 = false;
563419
563686
  }
563420
563687
  } else if (!allowMulti) {
563421
563688
  const exist = connectedEdges.some((link) => {
@@ -563424,17 +563691,17 @@ var require_edge3 = __commonJS({
563424
563691
  return s5 && t8 && s5.cell === source.cell && t8.cell === target.cell;
563425
563692
  });
563426
563693
  if (exist) {
563427
- valid = false;
563694
+ valid2 = false;
563428
563695
  }
563429
563696
  }
563430
563697
  }
563431
563698
  }
563432
563699
  }
563433
563700
  }
563434
- if (valid && validate2 != null) {
563435
- valid = doValidate(validate2);
563701
+ if (valid2 && validate2 != null) {
563702
+ valid2 = doValidate(validate2);
563436
563703
  }
563437
- return valid;
563704
+ return valid2;
563438
563705
  }
563439
563706
  allowConnectToBlank(edge) {
563440
563707
  const graph = this.graph;
@@ -563727,8 +563994,8 @@ var require_edge3 = __commonJS({
563727
563994
  } else {
563728
563995
  this.arrowheadDragged(data, x3, y5);
563729
563996
  }
563730
- const valid = this.validateEdge(this.cell, data.terminalType, data.initialTerminal);
563731
- if (valid) {
563997
+ const valid2 = this.validateEdge(this.cell, data.terminalType, data.initialTerminal);
563998
+ if (valid2) {
563732
563999
  this.finishEmbedding(data);
563733
564000
  this.notifyConnectionEvent(data, e6);
563734
564001
  } else {
@@ -571557,11 +571824,11 @@ var require_parse2 = __commonJS({
571557
571824
  var require_valid3 = __commonJS({
571558
571825
  "../model/node_modules/semver/functions/valid.js"(exports2, module2) {
571559
571826
  var parse4 = require_parse2();
571560
- var valid = (version4, options) => {
571827
+ var valid2 = (version4, options) => {
571561
571828
  const v6 = parse4(version4, options);
571562
571829
  return v6 ? v6.version : null;
571563
571830
  };
571564
- module2.exports = valid;
571831
+ module2.exports = valid2;
571565
571832
  }
571566
571833
  });
571567
571834
 
@@ -571743,8 +572010,8 @@ var require_gt2 = __commonJS({
571743
572010
  var require_lt2 = __commonJS({
571744
572011
  "../model/node_modules/semver/functions/lt.js"(exports2, module2) {
571745
572012
  var compare = require_compare2();
571746
- var lt2 = (a6, b6, loose) => compare(a6, b6, loose) < 0;
571747
- module2.exports = lt2;
572013
+ var lt3 = (a6, b6, loose) => compare(a6, b6, loose) < 0;
572014
+ module2.exports = lt3;
571748
572015
  }
571749
572016
  });
571750
572017
 
@@ -571782,7 +572049,7 @@ var require_cmp2 = __commonJS({
571782
572049
  var neq = require_neq2();
571783
572050
  var gt2 = require_gt2();
571784
572051
  var gte2 = require_gte2();
571785
- var lt2 = require_lt2();
572052
+ var lt3 = require_lt2();
571786
572053
  var lte2 = require_lte2();
571787
572054
  var cmp = (a6, op, b6, loose) => {
571788
572055
  switch (op) {
@@ -571809,7 +572076,7 @@ var require_cmp2 = __commonJS({
571809
572076
  case ">=":
571810
572077
  return gte2(a6, b6, loose);
571811
572078
  case "<":
571812
- return lt2(a6, b6, loose);
572079
+ return lt3(a6, b6, loose);
571813
572080
  case "<=":
571814
572081
  return lte2(a6, b6, loose);
571815
572082
  default:
@@ -573122,7 +573389,7 @@ var require_outside2 = __commonJS({
573122
573389
  var Range4 = require_range2();
573123
573390
  var satisfies = require_satisfies2();
573124
573391
  var gt2 = require_gt2();
573125
- var lt2 = require_lt2();
573392
+ var lt3 = require_lt2();
573126
573393
  var lte2 = require_lte2();
573127
573394
  var gte2 = require_gte2();
573128
573395
  var outside = (version4, range3, hilo, options) => {
@@ -573133,12 +573400,12 @@ var require_outside2 = __commonJS({
573133
573400
  case ">":
573134
573401
  gtfn = gt2;
573135
573402
  ltefn = lte2;
573136
- ltfn = lt2;
573403
+ ltfn = lt3;
573137
573404
  comp = ">";
573138
573405
  ecomp = ">=";
573139
573406
  break;
573140
573407
  case "<":
573141
- gtfn = lt2;
573408
+ gtfn = lt3;
573142
573409
  ltefn = gte2;
573143
573410
  ltfn = gt2;
573144
573411
  comp = "<";
@@ -573290,29 +573557,29 @@ var require_subset2 = __commonJS({
573290
573557
  if (sub2.length === 1 && sub2[0].semver === ANY)
573291
573558
  return dom.length === 1 && dom[0].semver === ANY;
573292
573559
  const eqSet = /* @__PURE__ */ new Set();
573293
- let gt2, lt2;
573560
+ let gt2, lt3;
573294
573561
  for (const c6 of sub2) {
573295
573562
  if (c6.operator === ">" || c6.operator === ">=")
573296
573563
  gt2 = higherGT(gt2, c6, options);
573297
573564
  else if (c6.operator === "<" || c6.operator === "<=")
573298
- lt2 = lowerLT(lt2, c6, options);
573565
+ lt3 = lowerLT(lt3, c6, options);
573299
573566
  else
573300
573567
  eqSet.add(c6.semver);
573301
573568
  }
573302
573569
  if (eqSet.size > 1)
573303
573570
  return null;
573304
573571
  let gtltComp;
573305
- if (gt2 && lt2) {
573306
- gtltComp = compare(gt2.semver, lt2.semver, options);
573572
+ if (gt2 && lt3) {
573573
+ gtltComp = compare(gt2.semver, lt3.semver, options);
573307
573574
  if (gtltComp > 0)
573308
573575
  return null;
573309
- else if (gtltComp === 0 && (gt2.operator !== ">=" || lt2.operator !== "<="))
573576
+ else if (gtltComp === 0 && (gt2.operator !== ">=" || lt3.operator !== "<="))
573310
573577
  return null;
573311
573578
  }
573312
573579
  for (const eq4 of eqSet) {
573313
573580
  if (gt2 && !satisfies(eq4, String(gt2), options))
573314
573581
  return null;
573315
- if (lt2 && !satisfies(eq4, String(lt2), options))
573582
+ if (lt3 && !satisfies(eq4, String(lt3), options))
573316
573583
  return null;
573317
573584
  for (const c6 of dom) {
573318
573585
  if (!satisfies(eq4, String(c6), options))
@@ -573333,20 +573600,20 @@ var require_subset2 = __commonJS({
573333
573600
  } else if (gt2.operator === ">=" && !satisfies(gt2.semver, String(c6), options))
573334
573601
  return false;
573335
573602
  }
573336
- if (lt2) {
573603
+ if (lt3) {
573337
573604
  if (c6.operator === "<" || c6.operator === "<=") {
573338
- lower = lowerLT(lt2, c6, options);
573339
- if (lower === c6 && lower !== lt2)
573605
+ lower = lowerLT(lt3, c6, options);
573606
+ if (lower === c6 && lower !== lt3)
573340
573607
  return false;
573341
- } else if (lt2.operator === "<=" && !satisfies(lt2.semver, String(c6), options))
573608
+ } else if (lt3.operator === "<=" && !satisfies(lt3.semver, String(c6), options))
573342
573609
  return false;
573343
573610
  }
573344
- if (!c6.operator && (lt2 || gt2) && gtltComp !== 0)
573611
+ if (!c6.operator && (lt3 || gt2) && gtltComp !== 0)
573345
573612
  return false;
573346
573613
  }
573347
- if (gt2 && hasDomLT && !lt2 && gtltComp !== 0)
573614
+ if (gt2 && hasDomLT && !lt3 && gtltComp !== 0)
573348
573615
  return false;
573349
- if (lt2 && hasDomGT && !gt2 && gtltComp !== 0)
573616
+ if (lt3 && hasDomGT && !gt2 && gtltComp !== 0)
573350
573617
  return false;
573351
573618
  return true;
573352
573619
  };
@@ -612375,7 +612642,7 @@ var init_project3 = __esm({
612375
612642
  }
612376
612643
  if (sceneId === this.currentScene.refId)
612377
612644
  return;
612378
- await this.flushCurrentScenePersistenceOrThrow();
612645
+ await this.flushCurrentScenePersistence();
612379
612646
  const sceneAsset = await this.root.assetStore.getAssetByRef({ refId: sceneId });
612380
612647
  const oldScene = this.currentScene;
612381
612648
  const oldEngineScene = oldScene.engineSceneObject;
@@ -612423,7 +612690,7 @@ var init_project3 = __esm({
612423
612690
  *
612424
612691
  * @throws 当 flush 触发的 save 失败(`syncStatus === "error"`)或 savingPromise reject 时
612425
612692
  */
612426
- async flushCurrentScenePersistenceOrThrow() {
612693
+ async flushCurrentScenePersistence() {
612427
612694
  await this.debouncedUpdateSceneAsset.flush();
612428
612695
  if (this.syncStatus === "error") {
612429
612696
  throw new Error("current scene failed to save, refusing to switch to avoid data loss");
@@ -612432,9 +612699,6 @@ var init_project3 = __esm({
612432
612699
  await this.savingPromise;
612433
612700
  }
612434
612701
  }
612435
- async flushCurrentScenePersistenceForAgent() {
612436
- await this.flushCurrentScenePersistenceOrThrow();
612437
- }
612438
612702
  async saveCurrentSceneForPreview() {
612439
612703
  const sceneId = this.currentScene?.refId;
612440
612704
  if (!sceneId)
@@ -620279,10 +620543,6 @@ var init_EntityModelProjection = __esm({
620279
620543
  }
620280
620544
  }
620281
620545
  _addComponentToModel(model, componentId, componentState) {
620282
- const stale = model.getComponentByTypeName?.(componentState.type);
620283
- if (stale && stale.id !== componentId) {
620284
- model.removeComponentFromDomain?.(stale.id);
620285
- }
620286
620546
  model.addComponentFromDomain?.(componentId, componentState);
620287
620547
  }
620288
620548
  _removeComponentFromModel(model, componentId) {
@@ -622569,14 +622829,6 @@ var init_refreshAssetReferences = __esm({
622569
622829
  });
622570
622830
 
622571
622831
  // ../model/src/modules/scene/reloadSceneStateFromAsset.ts
622572
- async function reloadSceneStateFromAsset(opts) {
622573
- const nextState = createEmptyDomainState();
622574
- nextState.version = opts.preserveVersion;
622575
- nextState.assets = opts.preserveAssets;
622576
- opts.domainStore.reset(nextState);
622577
- await opts.sceneStore.init(opts.sceneAsset);
622578
- opts.sceneFacade.initSettingsSystem(collectSceneSettings(opts.sceneStore));
622579
- }
622580
622832
  var init_reloadSceneStateFromAsset = __esm({
622581
622833
  "../model/src/modules/scene/reloadSceneStateFromAsset.ts"() {
622582
622834
  "use strict";
@@ -622664,6 +622916,10 @@ var init_FolderAsset = __esm({
622664
622916
  }
622665
622917
  async initByMain(blob) {
622666
622918
  }
622919
+ /**
622920
+ * Folder 无主文件 — 必须显式 return `null`(`undefined` 会被 `createMainBlob` 当
622921
+ * "子类忘 return" 抛错,见 `createByAddUploadSource`)。
622922
+ */
622667
622923
  initByCreation(routes, name16, params) {
622668
622924
  return Promise.resolve(null);
622669
622925
  }
@@ -622768,9 +623024,13 @@ var init_InstanceEditorAsset = __esm({
622768
623024
  static _tempBoundingBox = new import_engine78.BoundingBox();
622769
623025
  isTemplate = true;
622770
623026
  _clonedEntities = [];
622771
- _instances = /* @__PURE__ */ new Map();
622772
623027
  _rootKey = "";
622773
623028
  _tempSize = 0;
623029
+ /**
623030
+ * DomainStore.entities[*].instance.assetId 是 asset→instance 关系的唯一来源。
623031
+ * 本类不维护 mirror cache:hydrate 时 cache 不重建会产生 dangling assetId 残留
623032
+ * (save 时 codec 序列化失败)。query 走 O(N),只在删除/UI dialog 非热路径调用。
623033
+ */
622774
623034
  _buildInstanceLink() {
622775
623035
  const assetType = this.getMetaConfig().type;
622776
623036
  if (assetType !== "Prefab" && assetType !== "glTF")
@@ -622817,10 +623077,6 @@ var init_InstanceEditorAsset = __esm({
622817
623077
  } else if (instanceLink) {
622818
623078
  entity.pendingInstance = instanceLink;
622819
623079
  }
622820
- this._instances.set(entity.id, entity.entityManager);
622821
- entity.on("delete", () => {
622822
- this.removeInstance(entity);
622823
- });
622824
623080
  }
622825
623081
  removeInstance(entity) {
622826
623082
  const domainInstance = entity.root.domainStore.getNormalizedState().entities[entity.id]?.instance;
@@ -622829,10 +623085,20 @@ var init_InstanceEditorAsset = __esm({
622829
623085
  } else {
622830
623086
  entity.pendingInstance = null;
622831
623087
  }
622832
- this._instances.delete(entity.id);
623088
+ }
623089
+ /** 所有引用该 asset 的 entityId(子类 PrefabAsset batch 操作用)。 */
623090
+ _queryInstanceEntityIdsFromDomain() {
623091
+ const entities = this.root.domainStore.state.entities;
623092
+ const ids = [];
623093
+ for (const eid of Object.keys(entities)) {
623094
+ if (entities[eid]?.instance?.assetId === this.id) {
623095
+ ids.push(eid);
623096
+ }
623097
+ }
623098
+ return ids;
622833
623099
  }
622834
623100
  get instanceCount() {
622835
- return this._instances.size;
623101
+ return this._queryInstanceEntityIdsFromDomain().length;
622836
623102
  }
622837
623103
  static resolveInstanceEntityIds(trackedIds, entities) {
622838
623104
  const ids = /* @__PURE__ */ new Set();
@@ -622847,24 +623113,28 @@ var init_InstanceEditorAsset = __esm({
622847
623113
  }
622848
623114
  getInstanceEntityIds() {
622849
623115
  return _InstanceEditorAsset.resolveInstanceEntityIds(
622850
- Array.from(this._instances.keys()),
623116
+ this._queryInstanceEntityIdsFromDomain(),
622851
623117
  this.root.domainStore.state.entities
622852
623118
  );
622853
623119
  }
622854
- /** 解除所有实例的资产引用(不销毁实体)。子类可 override 做 unpack 等操作。 */
623120
+ /**
623121
+ * 解除所有实例的资产引用(不销毁实体)+ cascade 清掉 prefab.bindings 中对该 asset 的 binding,
623122
+ * 否则 binding 残留为 dangling ref,save 时 codec throw。
623123
+ * 走 prefabFacade.unpackByAsset 保持 byAssetId 反向索引同步。
623124
+ */
622855
623125
  unpackAllInstances() {
622856
- this._instances.forEach((entityManager, id) => {
622857
- const entityModel = entityManager.entities.get(id);
622858
- if (entityModel) {
622859
- const domainInstance = entityModel.root.domainStore.getNormalizedState().entities[entityModel.id]?.instance;
622860
- if (domainInstance !== void 0) {
622861
- entityModel.root.entityFacade.updateEntity(entityModel.id, { instance: null });
622862
- } else {
622863
- entityModel.pendingInstance = null;
622864
- }
623126
+ const bindings = this.root.domainStore.state.prefab?.bindings;
623127
+ const hasBinding = bindings && Object.values(bindings).some((b6) => b6?.assetId === this.id);
623128
+ if (hasBinding) {
623129
+ this.root.prefabFacade.unpackByAsset(this.id);
623130
+ }
623131
+ const entityIds = this._queryInstanceEntityIdsFromDomain();
623132
+ for (const eid of entityIds) {
623133
+ const entity = this.root.domainStore.state.entities?.[eid];
623134
+ if (entity?.instance?.assetId === this.id) {
623135
+ this.root.entityFacade.updateEntity(eid, { instance: null });
622865
623136
  }
622866
- });
622867
- this._instances.clear();
623137
+ }
622868
623138
  }
622869
623139
  afterDelete() {
622870
623140
  this.unpackAllInstances();
@@ -622885,13 +623155,6 @@ var init_InstanceEditorAsset = __esm({
622885
623155
  console.warn(`[InstanceEditorAsset] Failed to create drag temp entity for asset ${this.id}:`, e6);
622886
623156
  }
622887
623157
  }
622888
- _destroyInstances() {
622889
- this._instances.forEach((entityManager, id) => {
622890
- const entityModel = entityManager.entities.get(id);
622891
- entityModel?.destroy();
622892
- });
622893
- this._instances.clear();
622894
- }
622895
623158
  async updateThumbnail() {
622896
623159
  if (this._tempSize) {
622897
623160
  super.updateThumbnail();
@@ -623059,11 +623322,10 @@ var init_modules = __esm({
623059
623322
  });
623060
623323
 
623061
623324
  // ../model/src/postmen.ts
623062
- var PostmenClient, postmenLogger, publisher, TEXT_ASSET_TYPES2, PostmenWS, remoteAssetIngest;
623325
+ var PostmenClient, postmenLogger, publisher;
623063
623326
  var init_postmen = __esm({
623064
623327
  "../model/src/postmen.ts"() {
623065
623328
  "use strict";
623066
- init_src8();
623067
623329
  init_src4();
623068
623330
  init_request();
623069
623331
  init_src();
@@ -623074,406 +623336,6 @@ var init_postmen = __esm({
623074
623336
  PostmenClient = window.PostmenClient;
623075
623337
  postmenLogger = logger("postmen");
623076
623338
  publisher = EventBus.createPublisher();
623077
- TEXT_ASSET_TYPES2 = /* @__PURE__ */ new Set(["Scene", "Prefab", "script", "Shader", "ShaderChunk", "StateMachineScript"]);
623078
- PostmenWS = class _PostmenWS {
623079
- static APP_NAME = "GALACEAN";
623080
- static BIZ_TYPE = "P-galacean-msg";
623081
- static pendingRefreshes = [];
623082
- static pendingDedup = /* @__PURE__ */ new Set();
623083
- static rafScheduled = false;
623084
- static pendingSceneRef = null;
623085
- static collectAssetPickerReferences(target, assetId) {
623086
- const matches2 = [];
623087
- const properties = getPropertyConfigs(target);
623088
- for (const key2 in properties) {
623089
- const config2 = properties[key2];
623090
- if (!config2 || config2.type !== "AssetPicker" /* AssetPicker */)
623091
- continue;
623092
- const value = target[key2];
623093
- if (value && typeof value === "object" && "refId" in value && value.refId === assetId) {
623094
- matches2.push({ target, key: key2 });
623095
- }
623096
- }
623097
- return matches2;
623098
- }
623099
- static enqueuePendingRefresh(match) {
623100
- const targetId = match.target?.id ?? "";
623101
- const dedupKey = `${targetId}::${match.key}`;
623102
- if (this.pendingDedup.has(dedupKey))
623103
- return;
623104
- this.pendingDedup.add(dedupKey);
623105
- this.pendingRefreshes.push(match);
623106
- }
623107
- static flushPendingSceneReferenceRefreshes() {
623108
- this.rafScheduled = false;
623109
- if (rootStore.sceneStore !== this.pendingSceneRef) {
623110
- this.pendingRefreshes.length = 0;
623111
- this.pendingDedup.clear();
623112
- this.pendingSceneRef = null;
623113
- return;
623114
- }
623115
- const pending = this.pendingRefreshes;
623116
- this.pendingRefreshes = [];
623117
- this.pendingDedup.clear();
623118
- this.pendingSceneRef = null;
623119
- for (const { target, key: key2 } of pending) {
623120
- try {
623121
- target.triggerPropertyChange(key2, false);
623122
- } catch (error49) {
623123
- console.warn("[postmen] Failed to refresh asset reference:", error49, { key: key2 });
623124
- }
623125
- }
623126
- }
623127
- static refreshSceneEntityComponentReferences(assetId) {
623128
- const sceneStore = rootStore.sceneStore;
623129
- if (!sceneStore)
623130
- return;
623131
- if (sceneStore !== this.pendingSceneRef) {
623132
- this.pendingRefreshes.length = 0;
623133
- this.pendingDedup.clear();
623134
- this.pendingSceneRef = sceneStore;
623135
- }
623136
- for (const match of this.collectAssetPickerReferences(sceneStore, assetId)) {
623137
- this.enqueuePendingRefresh(match);
623138
- }
623139
- for (const [, entity] of sceneStore.iterateEntityModels()) {
623140
- for (const component2 of entity.components) {
623141
- for (const match of this.collectAssetPickerReferences(component2, assetId)) {
623142
- this.enqueuePendingRefresh(match);
623143
- }
623144
- }
623145
- }
623146
- for (const entity of sceneStore.strippedEntities.values()) {
623147
- for (const component2 of entity.components) {
623148
- for (const match of this.collectAssetPickerReferences(component2, assetId)) {
623149
- this.enqueuePendingRefresh(match);
623150
- }
623151
- }
623152
- }
623153
- if (!this.rafScheduled && this.pendingRefreshes.length > 0) {
623154
- this.rafScheduled = true;
623155
- requestAnimationFrame(() => {
623156
- this.flushPendingSceneReferenceRefreshes();
623157
- });
623158
- }
623159
- }
623160
- static create(projectId) {
623161
- PostmenClient.initialize(
623162
- _PostmenWS.getOpts(projectId.toString()),
623163
- _PostmenWS.stateListener,
623164
- () => _PostmenWS.getAuthToken(projectId.toString())
623165
- );
623166
- PostmenClient.register(_PostmenWS.BIZ_TYPE, (data) => {
623167
- const messageList = data.msgs;
623168
- for (const message of messageList) {
623169
- postmenLogger.info(message);
623170
- let payload;
623171
- try {
623172
- payload = JSON.parse(message.payload);
623173
- } catch (error49) {
623174
- console.warn("[postmen] Ignore malformed payload:", error49, message);
623175
- continue;
623176
- }
623177
- switch (message.bizId) {
623178
- case "AssetCreate" /* AssetCreate */:
623179
- this.applyAssetCreate(payload);
623180
- break;
623181
- case "AssetUpdate" /* AssetUpdate */:
623182
- this.applyAssetUpdate(payload);
623183
- break;
623184
- case "AssetDelete" /* AssetDelete */:
623185
- this.applyAssetDelete(payload);
623186
- break;
623187
- }
623188
- }
623189
- });
623190
- }
623191
- static getOpts(projectId) {
623192
- let env = "prod";
623193
- switch (getEnv()) {
623194
- case "local" /* local */:
623195
- case "dev" /* dev */:
623196
- env = "stable";
623197
- break;
623198
- case "test" /* test */:
623199
- env = "test";
623200
- break;
623201
- case "pre" /* pre */:
623202
- case "prod" /* prod */:
623203
- env = "prod";
623204
- break;
623205
- }
623206
- return {
623207
- env,
623208
- appName: _PostmenWS.APP_NAME,
623209
- userId: `${projectId}-web-editor`
623210
- };
623211
- }
623212
- static async getAuthToken(projectId) {
623213
- const res = await request("/api/postmen/createAuthToken", {
623214
- method: "POST",
623215
- data: { projectId }
623216
- });
623217
- return res.data;
623218
- }
623219
- static stateListener(stateInfo) {
623220
- postmenLogger.info("[state]", stateInfo);
623221
- }
623222
- static safeParseJsonObject(value) {
623223
- if (value && typeof value === "object") {
623224
- return value;
623225
- }
623226
- if (typeof value !== "string")
623227
- return {};
623228
- try {
623229
- const parsed = JSON.parse(value);
623230
- if (parsed && typeof parsed === "object") {
623231
- return parsed;
623232
- }
623233
- } catch {
623234
- }
623235
- return {};
623236
- }
623237
- static async applyAssetCreate(info) {
623238
- const assetId = info.uuid;
623239
- const assetStore = rootStore.assetStore;
623240
- const name16 = typeof info.name === "string" ? info.name : assetStore.assets[assetId]?.name ?? "Unknown";
623241
- const parentId = info.parentId ? String(info.parentId) : null;
623242
- const url2 = info.url ? String(info.url) : void 0;
623243
- const metaString = typeof info.meta === "string" ? info.meta : JSON.stringify(info.meta ?? {});
623244
- const meta4 = this.safeParseJsonObject(metaString);
623245
- const assetType = typeof meta4.type === "string" ? meta4.type : "Unknown";
623246
- const projectAssetType = typeof info.type === "number" ? info.type === 1 ? 1 : 0 : typeof info.type === "string" && info.type.length > 0 ? parseInt(info.type, 10) === 1 ? 1 : 0 : 0;
623247
- let main3;
623248
- if (url2 && assetType !== "Folder") {
623249
- if (!TEXT_ASSET_TYPES2.has(assetType)) {
623250
- main3 = "";
623251
- } else {
623252
- try {
623253
- const res = await fetch(url2);
623254
- if (res.ok) {
623255
- main3 = await res.text();
623256
- } else {
623257
- main3 = "";
623258
- }
623259
- } catch (error49) {
623260
- main3 = "";
623261
- console.warn("[postmen] Failed to preload created asset content:", error49, info);
623262
- }
623263
- }
623264
- }
623265
- try {
623266
- const state = {
623267
- id: assetId,
623268
- name: name16,
623269
- type: assetType,
623270
- parentFolderId: parentId,
623271
- meta: meta4,
623272
- status: "ready",
623273
- serverId: String(info.id)
623274
- };
623275
- if (url2)
623276
- state.url = url2;
623277
- const op = rootStore.domainStore.state.assets[assetId] ? { op: "replace", path: `/assets/${assetId}`, value: state } : { op: "add", path: `/assets/${assetId}`, value: state };
623278
- rootStore.domainStore.applyRemote([op]);
623279
- } catch (error49) {
623280
- console.error("[postmen] failed to apply asset create to DomainStore:", error49, info);
623281
- }
623282
- if (url2 && assetType !== "Folder") {
623283
- const assetToLoad = assetStore.assets[assetId];
623284
- if (assetToLoad && !assetToLoad.isInitCompleted) {
623285
- const preloaded = TEXT_ASSET_TYPES2.has(assetType) && typeof main3 === "string" && main3.length > 0 ? {
623286
- blob: new Blob([main3], {
623287
- type: assetType === "Scene" || assetType === "Prefab" ? "application/json" : "text/plain"
623288
- }),
623289
- url: url2
623290
- } : void 0;
623291
- assetToLoad.loadMainFile(preloaded).catch((error49) => {
623292
- console.warn("[postmen] Failed to load created asset main file:", error49, info);
623293
- });
623294
- }
623295
- }
623296
- publisher.publish("asset-change", {
623297
- type: "add",
623298
- assetId,
623299
- name: name16,
623300
- parentId,
623301
- meta: meta4,
623302
- main: main3,
623303
- url: url2
623304
- });
623305
- n6(`Asset ${name16} created by ${info.operator}`, { icon: "\u26A0" });
623306
- }
623307
- static async applyAssetUpdate(info) {
623308
- const assetId = info.uuid;
623309
- const asset3 = rootStore.assetStore.assets[assetId];
623310
- if (!asset3) {
623311
- console.warn("[postmen] AssetUpdate for missing asset:", info);
623312
- return;
623313
- }
623314
- n6(`Asset ${asset3.name} updated by ${info.operator}`, { icon: "\u26A0" });
623315
- await EditorAsset.runWithGlobalAutoSaveSuspended(async () => {
623316
- await rootStore.domainStore.runAsRemote(async () => {
623317
- const url2 = info.url ? String(info.url) : void 0;
623318
- const isCurrentSceneUpdate = asset3.meta.type === "Scene" && rootStore.sceneStore?.refId === assetId;
623319
- const previousCurrentSceneMain = isCurrentSceneUpdate ? JSON.stringify(rootStore.sceneStore.toJSON()) : void 0;
623320
- const previousCurrentSceneAssets = isCurrentSceneUpdate ? rootStore.domainStore.state.assets : void 0;
623321
- const previousCurrentSceneVersion = isCurrentSceneUpdate ? rootStore.domainStore.state.version : void 0;
623322
- const previousCurrentSceneUrl = isCurrentSceneUpdate ? asset3.url : void 0;
623323
- let fetchedBlob;
623324
- let fetchedText;
623325
- if (url2) {
623326
- try {
623327
- const res = await fetch(url2);
623328
- if (res.ok) {
623329
- fetchedBlob = await res.blob();
623330
- if (TEXT_ASSET_TYPES2.has(asset3.meta.type)) {
623331
- fetchedText = await fetchedBlob.text();
623332
- }
623333
- } else {
623334
- console.warn("[postmen] Failed to fetch updated asset:", res.statusText, info);
623335
- }
623336
- } catch (error49) {
623337
- console.warn("[postmen] Failed to fetch updated asset:", error49, info);
623338
- }
623339
- if (fetchedBlob) {
623340
- asset3.setUrl(url2);
623341
- try {
623342
- await asset3.reloadMainFileFromRemote({ blob: fetchedBlob, url: url2 });
623343
- if (asset3.meta.type === "ShaderChunk" && typeof fetchedText === "string" && typeof asset3.updateCode === "function") {
623344
- ;
623345
- asset3.updateCode(fetchedText);
623346
- }
623347
- } catch (error49) {
623348
- console.warn("[postmen] Failed to apply updated asset main file:", error49, info);
623349
- }
623350
- try {
623351
- const assetState = rootStore.domainStore.state.assets[assetId];
623352
- if (assetState) {
623353
- const op = {
623354
- op: "url" in assetState ? "replace" : "add",
623355
- path: `/assets/${assetId}/url`,
623356
- value: url2
623357
- };
623358
- rootStore.domainStore.applyRemote([op]);
623359
- }
623360
- } catch (error49) {
623361
- console.error("[postmen] failed to apply asset update to DomainStore:", error49, info);
623362
- }
623363
- const main3 = TEXT_ASSET_TYPES2.has(asset3.meta.type) ? fetchedText : fetchedBlob;
623364
- if (asset3.meta.type === "Scene" && rootStore.sceneStore?.refId === assetId && typeof fetchedText === "string" && isCurrentSceneUpdate) {
623365
- try {
623366
- await reloadSceneStateFromAsset({
623367
- sceneStore: rootStore.sceneStore,
623368
- sceneFacade: rootStore.sceneFacade,
623369
- domainStore: rootStore.domainStore,
623370
- sceneAsset: asset3,
623371
- preserveAssets: rootStore.domainStore.state.assets,
623372
- preserveVersion: rootStore.domainStore.state.version
623373
- });
623374
- publisher.publish("asset-change", {
623375
- type: "modify",
623376
- assetId,
623377
- main: main3
623378
- });
623379
- } catch (error49) {
623380
- console.error("[postmen] Failed to reload current scene from updated Scene asset:", error49, info);
623381
- if (typeof previousCurrentSceneMain === "string" && previousCurrentSceneAssets && typeof previousCurrentSceneVersion === "number" && typeof previousCurrentSceneUrl === "string") {
623382
- try {
623383
- asset3.setUrl(previousCurrentSceneUrl);
623384
- await asset3.reloadMainFileFromRemote({
623385
- blob: new Blob([previousCurrentSceneMain], { type: "application/json" }),
623386
- url: previousCurrentSceneUrl
623387
- });
623388
- await reloadSceneStateFromAsset({
623389
- sceneStore: rootStore.sceneStore,
623390
- sceneFacade: rootStore.sceneFacade,
623391
- domainStore: rootStore.domainStore,
623392
- sceneAsset: asset3,
623393
- preserveAssets: previousCurrentSceneAssets,
623394
- preserveVersion: previousCurrentSceneVersion
623395
- });
623396
- } catch (rollbackError) {
623397
- console.error(
623398
- "[postmen] Failed to rollback current scene after Scene init failure:",
623399
- rollbackError,
623400
- info
623401
- );
623402
- }
623403
- }
623404
- }
623405
- } else {
623406
- if (main3 !== void 0) {
623407
- publisher.publish("asset-change", {
623408
- type: "modify",
623409
- assetId,
623410
- main: main3
623411
- });
623412
- }
623413
- }
623414
- }
623415
- }
623416
- if (info.name && asset3.name !== info.name) {
623417
- try {
623418
- rootStore.domainStore.applyRemote([
623419
- { op: "replace", path: `/assets/${assetId}/name`, value: String(info.name) }
623420
- ]);
623421
- } catch (error49) {
623422
- console.error("[postmen] failed to apply asset rename to DomainStore:", error49, info);
623423
- }
623424
- publisher.publish("asset-change", {
623425
- type: "rename",
623426
- assetId,
623427
- newName: String(info.name)
623428
- });
623429
- }
623430
- if (info.parentId !== void 0) {
623431
- const parentFolderId = info.parentId ? String(info.parentId) : null;
623432
- if (asset3.parentFolderId !== parentFolderId) {
623433
- try {
623434
- rootStore.domainStore.applyRemote([
623435
- { op: "replace", path: `/assets/${assetId}/parentFolderId`, value: parentFolderId }
623436
- ]);
623437
- } catch (error49) {
623438
- console.error("[postmen] failed to apply asset move to DomainStore:", error49, info);
623439
- }
623440
- publisher.publish("asset-change", {
623441
- type: "move",
623442
- assetIds: [assetId],
623443
- targeParentId: parentFolderId
623444
- });
623445
- }
623446
- }
623447
- });
623448
- });
623449
- }
623450
- static async applyAssetDelete(info) {
623451
- for (const assetInfo2 of info.list) {
623452
- const asset3 = rootStore.assetStore.assets[assetInfo2.uuid];
623453
- const existsInDomain = Boolean(rootStore.domainStore.state.assets[assetInfo2.uuid]);
623454
- if (!asset3 && !existsInDomain) {
623455
- console.warn("[postmen] AssetDelete for missing asset:", assetInfo2);
623456
- continue;
623457
- }
623458
- try {
623459
- rootStore.domainStore.applyRemote([{ op: "remove", path: `/assets/${assetInfo2.uuid}` }]);
623460
- } catch (error49) {
623461
- console.error("[postmen] failed to apply asset delete to DomainStore:", error49, assetInfo2);
623462
- }
623463
- publisher.publish("asset-change", {
623464
- type: "delete",
623465
- assetIds: [assetInfo2.uuid]
623466
- });
623467
- const assetName = asset3?.name ?? assetInfo2.uuid;
623468
- n6(`Asset ${assetName} deleted by ${info.operator}`, { icon: "\u26A0", style: { color: "red" } });
623469
- }
623470
- }
623471
- };
623472
- remoteAssetIngest = {
623473
- applyAssetCreate: PostmenWS.applyAssetCreate.bind(PostmenWS),
623474
- applyAssetUpdate: PostmenWS.applyAssetUpdate.bind(PostmenWS),
623475
- applyAssetDelete: PostmenWS.applyAssetDelete.bind(PostmenWS)
623476
- };
623477
623339
  }
623478
623340
  });
623479
623341
 
@@ -690149,15 +690011,6 @@ var init_GlTFAsset = __esm({
690149
690011
  _instantiateEngineObject() {
690150
690012
  return this.engineObject.instantiateSceneRoot();
690151
690013
  }
690152
- _destroyInstances() {
690153
- this._instances.forEach((entityManager, id) => {
690154
- const entityModel = entityManager.entities.get(id);
690155
- if (entityModel) {
690156
- entityModel.destroy();
690157
- }
690158
- });
690159
- this._instances.clear();
690160
- }
690161
690014
  _internalReplaceMaterial(index2, material) {
690162
690015
  const materialTargets = this._findComponentsByMaterialPathIndex(index2);
690163
690016
  materialTargets.forEach(({ component: component2, materialIndex }) => {
@@ -719936,10 +719789,12 @@ var init_PrefabAsset = __esm({
719936
719789
  }
719937
719790
  }
719938
719791
  unpackAllInstances() {
719939
- this._instances.forEach((entityManager, id) => {
719940
- const entityModel = entityManager.entities.get(id);
719792
+ const sceneStore = this.root.sceneStore;
719793
+ const entityIds = this._queryInstanceEntityIdsFromDomain();
719794
+ for (const id of entityIds) {
719795
+ const entityModel = sceneStore.getEntityModel?.(id);
719941
719796
  entityModel?.unpackPrefab();
719942
- });
719797
+ }
719943
719798
  super.unpackAllInstances();
719944
719799
  }
719945
719800
  async instantiate(entityManager, rootTransform, options) {
@@ -720291,7 +720146,6 @@ var init_PrefabAsset = __esm({
720291
720146
  async replaceInstance(targetEntityId, entityManager, options) {
720292
720147
  const targetEntity = entityManager.entities.get(targetEntityId);
720293
720148
  if (!targetEntity) {
720294
- this._instances.delete(targetEntityId);
720295
720149
  return null;
720296
720150
  }
720297
720151
  const engineTransform = targetEntity?.engineObject?.transform;
@@ -720318,12 +720172,12 @@ var init_PrefabAsset = __esm({
720318
720172
  return newEntityModel;
720319
720173
  }
720320
720174
  _refreshTrackedInstanceBindings(options) {
720321
- for (const [id, entityManager] of Array.from(this._instances)) {
720322
- const entityModel = entityManager.entities.get(id);
720323
- if (!entityModel) {
720324
- this._instances.delete(id);
720175
+ const sceneStore = this.root.sceneStore;
720176
+ const entityIds = this._queryInstanceEntityIdsFromDomain();
720177
+ for (const id of entityIds) {
720178
+ const entityModel = sceneStore.getEntityModel?.(id);
720179
+ if (!entityModel)
720325
720180
  continue;
720326
- }
720327
720181
  this._bindInstantiatedEntity(entityModel, options);
720328
720182
  }
720329
720183
  }
@@ -720475,10 +720329,12 @@ var init_PrefabAsset = __esm({
720475
720329
  if (options?.replaceInstances !== false) {
720476
720330
  const resetRootTransformBindingIds = new Set(options?.resetRootTransformBindingIds ?? []);
720477
720331
  const instanceOptions = options?.undoable ? { undoable: true } : void 0;
720332
+ const sceneStore = this.root.sceneStore;
720333
+ const entityIds = this._queryInstanceEntityIdsFromDomain();
720478
720334
  await Promise.all(
720479
- Array.from(this._instances, ([id, entityManager]) => {
720480
- const bindingId = entityManager.root.domainStore.getNormalizedState().entities[id]?.instance?.bindingId;
720481
- return this.replaceInstance(id, entityManager, {
720335
+ entityIds.map((id) => {
720336
+ const bindingId = this.root.domainStore.getNormalizedState().entities[id]?.instance?.bindingId;
720337
+ return this.replaceInstance(id, sceneStore, {
720482
720338
  ...instanceOptions ?? {},
720483
720339
  resetRootTransform: bindingId !== void 0 && resetRootTransformBindingIds.has(bindingId),
720484
720340
  ...options?.structuralDeltaMode ? { structuralDeltaMode: options.structuralDeltaMode } : {}
@@ -727671,6 +727527,11 @@ var init_ParticleRendererComponent = __esm({
727671
727527
  object3.enabled = false;
727672
727528
  this._applyEditorRuntimeState();
727673
727529
  }
727530
+ /**
727531
+ * generator 子模块全部按 optional 处理:`source?.field ?? this.field`,缺失保留 instance 默认。
727532
+ * Agent 路径(`particleRenderer.add` schema 允许罕用模块省略)下,worker 可能不传整个
727533
+ * textureSheetAnimation,deserialize 必须容错。
727534
+ */
727674
727535
  deserialize(data) {
727675
727536
  const props = data.props;
727676
727537
  this._enabled = props?.enabled ?? true;
@@ -727693,31 +727554,30 @@ var init_ParticleRendererComponent = __esm({
727693
727554
  forceOverLifetime,
727694
727555
  noise
727695
727556
  } = props.generator;
727696
- this.duration = main3.duration;
727697
- this.isLoop = main3.isLoop;
727698
- this.startDelay = main3.startDelay;
727699
- this.startLifetime = main3.startLifetime;
727700
- this.startSpeed = main3.startSpeed;
727701
- this.startSize.enabled = main3.startSize3D;
727702
- this.startSize.x = main3.startSizeX;
727703
- this.startSize.y = main3.startSizeY;
727704
- this.startSize.z = main3.startSizeZ;
727705
- this.startRotation.enabled = main3.startRotation3D;
727706
- this.startRotation.x = main3.startRotationX;
727707
- this.startRotation.y = main3.startRotationY;
727708
- this.startRotation.z = main3.startRotationZ;
727709
- this.flipRotation = main3.flipRotation;
727710
- this.startColor = main3.startColor;
727711
- this.gravityModifier = main3.gravityModifier;
727712
- this.simulationSpace = main3.simulationSpace;
727713
- this.simulationSpeed = main3.simulationSpeed;
727714
- this.scalingMode = main3.scalingMode;
727715
- this.playOnEnabled = main3.playOnEnabled;
727716
- this.maxParticles = main3.maxParticles;
727717
- this._emissionModuleEnabled = emission.enabled;
727718
- this.rateOverTime = emission.rateOverTime;
727719
- this.shape = emission.shape;
727720
- if (emission.shape?.class === "Null" || emission.shape === null) {
727557
+ this.duration = main3?.duration ?? this.duration;
727558
+ this.isLoop = main3?.isLoop ?? this.isLoop;
727559
+ this.startDelay = main3?.startDelay ?? this.startDelay;
727560
+ this.startLifetime = main3?.startLifetime ?? this.startLifetime;
727561
+ this.startSpeed = main3?.startSpeed ?? this.startSpeed;
727562
+ this.startSize.enabled = main3?.startSize3D ?? this.startSize.enabled;
727563
+ this.startSize.x = main3?.startSizeX ?? this.startSize.x;
727564
+ this.startSize.y = main3?.startSizeY ?? this.startSize.y;
727565
+ this.startSize.z = main3?.startSizeZ ?? this.startSize.z;
727566
+ this.startRotation.enabled = main3?.startRotation3D ?? this.startRotation.enabled;
727567
+ this.startRotation.x = main3?.startRotationX ?? this.startRotation.x;
727568
+ this.startRotation.y = main3?.startRotationY ?? this.startRotation.y;
727569
+ this.startRotation.z = main3?.startRotationZ ?? this.startRotation.z;
727570
+ this.flipRotation = main3?.flipRotation ?? this.flipRotation;
727571
+ this.startColor = main3?.startColor ?? this.startColor;
727572
+ this.gravityModifier = main3?.gravityModifier ?? this.gravityModifier;
727573
+ this.simulationSpace = main3?.simulationSpace ?? this.simulationSpace;
727574
+ this.simulationSpeed = main3?.simulationSpeed ?? this.simulationSpeed;
727575
+ this.scalingMode = main3?.scalingMode ?? this.scalingMode;
727576
+ this.playOnEnabled = main3?.playOnEnabled ?? this.playOnEnabled;
727577
+ this.maxParticles = main3?.maxParticles ?? this.maxParticles;
727578
+ this._emissionModuleEnabled = emission?.enabled ?? this._emissionModuleEnabled;
727579
+ this.rateOverTime = emission?.rateOverTime ?? this.rateOverTime;
727580
+ if (emission?.shape === null || emission?.shape?.class === "Null") {
727721
727581
  this.shape = {
727722
727582
  class: "ConeShape" /* ConeShape */,
727723
727583
  props: {
@@ -727728,66 +727588,69 @@ var init_ParticleRendererComponent = __esm({
727728
727588
  enabled: false
727729
727589
  }
727730
727590
  };
727591
+ this._emissionShapeModuleEnabled = false;
727592
+ } else {
727593
+ this.shape = emission?.shape ?? this.shape;
727594
+ this._emissionShapeModuleEnabled = emission?.shape?.props?.enabled ?? this._emissionShapeModuleEnabled;
727731
727595
  }
727732
- this._emissionShapeModuleEnabled = emission?.shape?.props?.enabled ?? true;
727733
727596
  this.bursts = Array.isArray(emission?.bursts) ? emission.bursts.map((burst) => {
727734
727597
  normalizeDeserializedBurstCycles(burst);
727735
727598
  return burst;
727736
727599
  }) : [];
727737
- this._sizeOverLifetimeModuleEnabled = sizeOverLifetime?.enabled ?? false;
727738
- this.size.enabled = sizeOverLifetime?.separateAxes ?? false;
727600
+ this._sizeOverLifetimeModuleEnabled = sizeOverLifetime?.enabled ?? this._sizeOverLifetimeModuleEnabled;
727601
+ this.size.enabled = sizeOverLifetime?.separateAxes ?? this.size.enabled;
727739
727602
  this.size.x = sizeOverLifetime?.sizeX ? { ...sizeOverLifetime.sizeX, module: "sizeOverLifetime" } : { ...cloneDeep(this.size.x), module: "sizeOverLifetime" };
727740
727603
  this.size.y = sizeOverLifetime?.sizeY ? { ...sizeOverLifetime.sizeY, module: "sizeOverLifetime" } : { ...cloneDeep(this.size.y), module: "sizeOverLifetime" };
727741
727604
  this.size.z = sizeOverLifetime?.sizeZ ? { ...sizeOverLifetime.sizeZ, module: "sizeOverLifetime" } : { ...cloneDeep(this.size.z), module: "sizeOverLifetime" };
727742
- this._rotationOverLifetimeModuleEnabled = rotationOverLifetime?.enabled ?? false;
727743
- this.rotation.enabled = rotationOverLifetime?.separateAxes ?? false;
727605
+ this._rotationOverLifetimeModuleEnabled = rotationOverLifetime?.enabled ?? this._rotationOverLifetimeModuleEnabled;
727606
+ this.rotation.enabled = rotationOverLifetime?.separateAxes ?? this.rotation.enabled;
727744
727607
  this.rotation.x = rotationOverLifetime?.rotationX ? { ...rotationOverLifetime.rotationX, module: "rotationOverLifetime" } : { ...cloneDeep(this.rotation.x), module: "rotationOverLifetime" };
727745
727608
  this.rotation.y = rotationOverLifetime?.rotationY ? { ...rotationOverLifetime.rotationY, module: "rotationOverLifetime" } : { ...cloneDeep(this.rotation.y), module: "rotationOverLifetime" };
727746
727609
  this.rotation.z = rotationOverLifetime?.rotationZ ? { ...rotationOverLifetime.rotationZ, module: "rotationOverLifetime" } : { ...cloneDeep(this.rotation.z), module: "rotationOverLifetime" };
727747
- this._velocityOverLifetimeModuleEnabled = velocityOverLifetime?.enabled ?? false;
727610
+ this._velocityOverLifetimeModuleEnabled = velocityOverLifetime?.enabled ?? this._velocityOverLifetimeModuleEnabled;
727748
727611
  this.velocityX = velocityOverLifetime?.velocityX ?? cloneDeep(this.velocityX);
727749
727612
  this.velocityY = velocityOverLifetime?.velocityY ?? cloneDeep(this.velocityY);
727750
727613
  this.velocityZ = velocityOverLifetime?.velocityZ ?? cloneDeep(this.velocityZ);
727751
- this.spaceMode = velocityOverLifetime?.space ?? import_engine161.ParticleSimulationSpace.Local;
727752
- this._limitVelocityOverLifetimeModuleEnabled = limitVelocityOverLifetime?.enabled ?? false;
727753
- this.speed.enabled = limitVelocityOverLifetime?.separateAxes ?? false;
727614
+ this.spaceMode = velocityOverLifetime?.space ?? this.spaceMode;
727615
+ this._limitVelocityOverLifetimeModuleEnabled = limitVelocityOverLifetime?.enabled ?? this._limitVelocityOverLifetimeModuleEnabled;
727616
+ this.speed.enabled = limitVelocityOverLifetime?.separateAxes ?? this.speed.enabled;
727754
727617
  const speedXData = limitVelocityOverLifetime?.speedX ?? limitVelocityOverLifetime?.speed;
727755
727618
  this.speed.x = speedXData ? { ...speedXData, module: "limitVelocityOverLifetime" } : { ...cloneDeep(this.speed.x), module: "limitVelocityOverLifetime" };
727756
727619
  this.speed.y = limitVelocityOverLifetime?.speedY ? { ...limitVelocityOverLifetime.speedY, module: "limitVelocityOverLifetime" } : { ...cloneDeep(this.speed.y), module: "limitVelocityOverLifetime" };
727757
727620
  this.speed.z = limitVelocityOverLifetime?.speedZ ? { ...limitVelocityOverLifetime.speedZ, module: "limitVelocityOverLifetime" } : { ...cloneDeep(this.speed.z), module: "limitVelocityOverLifetime" };
727758
- this.dampen = limitVelocityOverLifetime?.dampen ?? 0;
727621
+ this.dampen = limitVelocityOverLifetime?.dampen ?? this.dampen;
727759
727622
  this.drag = limitVelocityOverLifetime?.drag ? { ...limitVelocityOverLifetime.drag, module: "limitVelocityOverLifetime" } : createCurveOptions("limitVelocityOverLifetime");
727760
- this.multiplyDragByParticleSize = limitVelocityOverLifetime?.multiplyDragByParticleSize ?? false;
727761
- this.multiplyDragByParticleVelocity = limitVelocityOverLifetime?.multiplyDragByParticleVelocity ?? false;
727762
- this.limitVelocitySpaceMode = limitVelocityOverLifetime?.space ?? import_engine161.ParticleSimulationSpace.Local;
727763
- this._forceOverLifetimeModuleEnabled = forceOverLifetime?.enabled ?? false;
727623
+ this.multiplyDragByParticleSize = limitVelocityOverLifetime?.multiplyDragByParticleSize ?? this.multiplyDragByParticleSize;
727624
+ this.multiplyDragByParticleVelocity = limitVelocityOverLifetime?.multiplyDragByParticleVelocity ?? this.multiplyDragByParticleVelocity;
727625
+ this.limitVelocitySpaceMode = limitVelocityOverLifetime?.space ?? this.limitVelocitySpaceMode;
727626
+ this._forceOverLifetimeModuleEnabled = forceOverLifetime?.enabled ?? this._forceOverLifetimeModuleEnabled;
727764
727627
  this.forceX = forceOverLifetime?.forceX ?? createCurveOptions("forceOverLifetime");
727765
727628
  this.forceY = forceOverLifetime?.forceY ?? createCurveOptions("forceOverLifetime");
727766
727629
  this.forceZ = forceOverLifetime?.forceZ ?? createCurveOptions("forceOverLifetime");
727767
- this.forceSpaceMode = forceOverLifetime?.space ?? import_engine161.ParticleSimulationSpace.Local;
727630
+ this.forceSpaceMode = forceOverLifetime?.space ?? this.forceSpaceMode;
727768
727631
  if (colorOverLifetime) {
727769
- this._colorOverLifetimeModuleEnabled = colorOverLifetime.enabled;
727770
- this.color = colorOverLifetime.color;
727632
+ this._colorOverLifetimeModuleEnabled = colorOverLifetime.enabled ?? this._colorOverLifetimeModuleEnabled;
727633
+ this.color = colorOverLifetime.color ?? this.color;
727771
727634
  } else {
727772
727635
  this._colorOverLifetimeModuleEnabled = true;
727773
727636
  this.color = createDefaultGradientOptions();
727774
727637
  }
727775
- this._textureSheetAnimationModuleEnabled = textureSheetAnimation.enabled;
727776
- this.textureSheetAnimationType = textureSheetAnimation.type;
727777
- this.cycleCount = textureSheetAnimation.cycleCount;
727778
- this.tiling = textureSheetAnimation.tiling;
727779
- this.frameOverTime = textureSheetAnimation.frameOverTime;
727780
- this._noiseModuleEnabled = noise?.enabled ?? false;
727781
- this.noiseStrength.enabled = noise?.separateAxes ?? false;
727638
+ this._textureSheetAnimationModuleEnabled = textureSheetAnimation?.enabled ?? this._textureSheetAnimationModuleEnabled;
727639
+ this.textureSheetAnimationType = textureSheetAnimation?.type ?? this.textureSheetAnimationType;
727640
+ this.cycleCount = textureSheetAnimation?.cycleCount ?? this.cycleCount;
727641
+ this.tiling = textureSheetAnimation?.tiling ?? this.tiling;
727642
+ this.frameOverTime = textureSheetAnimation?.frameOverTime ?? this.frameOverTime;
727643
+ this._noiseModuleEnabled = noise?.enabled ?? this._noiseModuleEnabled;
727644
+ this.noiseStrength.enabled = noise?.separateAxes ?? this.noiseStrength.enabled;
727782
727645
  const strengthXData = noise?.strengthX;
727783
727646
  this.noiseStrength.x = strengthXData ? { ...strengthXData, module: "noise" } : { ...cloneDeep(this.noiseStrength.x), module: "noise" };
727784
727647
  this.noiseStrength.y = noise?.strengthY ? { ...noise.strengthY, module: "noise" } : { ...cloneDeep(this.noiseStrength.y), module: "noise" };
727785
727648
  this.noiseStrength.z = noise?.strengthZ ? { ...noise.strengthZ, module: "noise" } : { ...cloneDeep(this.noiseStrength.z), module: "noise" };
727786
- this.noiseFrequency = noise?.frequency ?? 0.5;
727787
- this.noiseScrollSpeed = noise?.scrollSpeed ?? 0;
727788
- this.noiseOctaveCount = noise?.octaveCount ?? 1;
727789
- this.noiseOctaveIntensityMultiplier = noise?.octaveIntensityMultiplier ?? 0.5;
727790
- this.noiseOctaveFrequencyMultiplier = noise?.octaveFrequencyMultiplier ?? 2;
727649
+ this.noiseFrequency = noise?.frequency ?? this.noiseFrequency;
727650
+ this.noiseScrollSpeed = noise?.scrollSpeed ?? this.noiseScrollSpeed;
727651
+ this.noiseOctaveCount = noise?.octaveCount ?? this.noiseOctaveCount;
727652
+ this.noiseOctaveIntensityMultiplier = noise?.octaveIntensityMultiplier ?? this.noiseOctaveIntensityMultiplier;
727653
+ this.noiseOctaveFrequencyMultiplier = noise?.octaveFrequencyMultiplier ?? this.noiseOctaveFrequencyMultiplier;
727791
727654
  }
727792
727655
  super.deserialize(data);
727793
727656
  }
@@ -730748,8 +730611,8 @@ var require_core_cjs_production_min = __commonJS({
730748
730611
  b8();
730749
730612
  }, [n8, C3, i8, b8, s7, l8, JSON.stringify(x5), JSON.stringify(p8), h9, u8, E4, f9, JSON.stringify(g7)]);
730750
730613
  }({ ...fe3, delta: X3, draggingRect: et2, pointerCoordinates: _e2, scrollableAncestors: Ye2, scrollableAncestorRects: Ve2 });
730751
- const lt2 = t8.useMemo(() => ({ active: G6, activeNode: de3, activeNodeRect: pe3, activatorEvent: ee4, collisions: tt2, containerNodeRect: ye3, dragOverlay: Ae3, draggableNodes: H5, droppableContainers: V5, droppableRects: se3, over: rt, measureDroppableContainers: le3, scrollableAncestors: Ye2, scrollableAncestorRects: Ve2, measuringConfiguration: ie2, measuringScheduled: ce2, windowRect: Xe2 }), [G6, de3, pe3, ee4, tt2, ye3, Ae3, H5, V5, se3, rt, le3, Ye2, Ve2, ie2, ce2, Xe2]), ct = t8.useMemo(() => ({ activatorEvent: ee4, activators: st, active: G6, activeNodeRect: pe3, ariaDescribedById: { draggable: re4 }, dispatch: N4, draggableNodes: H5, over: rt, measureDroppableContainers: le3 }), [ee4, st, G6, pe3, N4, re4, H5, rt, le3]);
730752
- return n7.createElement(a6.Provider, { value: K3 }, n7.createElement(ke2.Provider, { value: ct }, n7.createElement(Te2.Provider, { value: lt2 }, n7.createElement(ze.Provider, { value: it }, h8)), n7.createElement(Be, { disabled: false === (null == g6 ? void 0 : g6.restoreFocus) })), n7.createElement(d5, { ...g6, hiddenTextDescribedById: re4 }));
730614
+ const lt3 = t8.useMemo(() => ({ active: G6, activeNode: de3, activeNodeRect: pe3, activatorEvent: ee4, collisions: tt2, containerNodeRect: ye3, dragOverlay: Ae3, draggableNodes: H5, droppableContainers: V5, droppableRects: se3, over: rt, measureDroppableContainers: le3, scrollableAncestors: Ye2, scrollableAncestorRects: Ve2, measuringConfiguration: ie2, measuringScheduled: ce2, windowRect: Xe2 }), [G6, de3, pe3, ee4, tt2, ye3, Ae3, H5, V5, se3, rt, le3, Ye2, Ve2, ie2, ce2, Xe2]), ct = t8.useMemo(() => ({ activatorEvent: ee4, activators: st, active: G6, activeNodeRect: pe3, ariaDescribedById: { draggable: re4 }, dispatch: N4, draggableNodes: H5, over: rt, measureDroppableContainers: le3 }), [ee4, st, G6, pe3, N4, re4, H5, rt, le3]);
730615
+ return n7.createElement(a6.Provider, { value: K3 }, n7.createElement(ke2.Provider, { value: ct }, n7.createElement(Te2.Provider, { value: lt3 }, n7.createElement(ze.Provider, { value: it }, h8)), n7.createElement(Be, { disabled: false === (null == g6 ? void 0 : g6.restoreFocus) })), n7.createElement(d5, { ...g6, hiddenTextDescribedById: re4 }));
730753
730616
  });
730754
730617
  var Ue = t8.createContext(null);
730755
730618
  var je = "button";
@@ -741900,7 +741763,7 @@ var FileWatcher = class {
741900
741763
  };
741901
741764
 
741902
741765
  // src/utils/is-abort-error.ts
741903
- function isAbortError2(err2) {
741766
+ function isAbortError(err2) {
741904
741767
  if (!err2 || typeof err2 !== "object")
741905
741768
  return false;
741906
741769
  const { name: name16, message } = err2;
@@ -741957,7 +741820,7 @@ function isRetryableFetchNetworkError(err2) {
741957
741820
  return /fetch failed/i.test(err2.message);
741958
741821
  }
741959
741822
  function shouldAutoRetryWatchError(err2) {
741960
- if (isAbortError2(err2))
741823
+ if (isAbortError(err2))
741961
741824
  return false;
741962
741825
  if (!(err2 instanceof Error))
741963
741826
  return false;
@@ -742020,7 +741883,7 @@ function watchProject(opts) {
742020
741883
  if (!closed2)
742021
741884
  onPush?.(result2);
742022
741885
  } catch (err2) {
742023
- if (isAbortError2(err2)) {
741886
+ if (isAbortError(err2)) {
742024
741887
  continue;
742025
741888
  }
742026
741889
  consecutiveFailures++;
@@ -750638,7 +750501,7 @@ function buildDefaultScene(platform2) {
750638
750501
  return platform2 === "2d" ? buildDefaultScene2D() : buildDefaultScene3D();
750639
750502
  }
750640
750503
  async function createProject(opts) {
750641
- const { name: name16, platform: platform2 = "3d", engineVersion = "2.0.0-alpha.30", force = false } = opts;
750504
+ const { name: name16, platform: platform2 = "3d", engineVersion = "2.0.0-alpha.33", force = false } = opts;
750642
750505
  const outputDir = opts.outputDir ?? `./${slugify2(name16)}`;
750643
750506
  const absDir = import_node_path14.default.resolve(outputDir);
750644
750507
  await (0, import_promises12.mkdir)(absDir, { recursive: true });
@@ -752406,7 +752269,7 @@ function readCliVersionFromPackageJson() {
752406
752269
  const parsed = JSON.parse(raw);
752407
752270
  return typeof parsed.version === "string" && parsed.version.length > 0 ? parsed.version : "0.0.0";
752408
752271
  }
752409
- var CLI_VERSION = "2.0.0-alpha.24".length > 0 ? "2.0.0-alpha.24" : readCliVersionFromPackageJson();
752272
+ var CLI_VERSION = "2.0.0-alpha.26".length > 0 ? "2.0.0-alpha.26" : readCliVersionFromPackageJson();
752410
752273
 
752411
752274
  // src/cli.ts
752412
752275
  init_config();