@craft_eco/craft-mcp 0.1.28 → 0.1.30

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 (999) hide show
  1. package/README.md +21 -60
  2. package/bin/craft-mcp.mjs +7 -1
  3. package/dist-server/game-workflow/asset-import.mjs +5 -1
  4. package/dist-server/game-workflow/assets.mjs +6 -2
  5. package/dist-server/game-workflow/bundle-files.mjs +9 -6
  6. package/dist-server/game-workflow/check.mjs +8 -2
  7. package/dist-server/game-workflow/context-state.mjs +67 -0
  8. package/dist-server/game-workflow/draft-archive.mjs +147 -2
  9. package/dist-server/game-workflow/draft-upload-identity.mjs +11 -0
  10. package/dist-server/game-workflow/draft-uploads.mjs +108 -60
  11. package/dist-server/game-workflow/engines.mjs +3 -3
  12. package/dist-server/game-workflow/library-assets.mjs +2 -1
  13. package/dist-server/game-workflow/local-context.mjs +62 -0
  14. package/dist-server/game-workflow/native-context.mjs +289 -0
  15. package/dist-server/game-workflow/project-bundles.mjs +121 -4
  16. package/dist-server/game-workflow/project-context.mjs +183 -45
  17. package/dist-server/game-workflow/project-leases.mjs +101 -30
  18. package/dist-server/game-workflow/projects.mjs +92 -14
  19. package/dist-server/game-workflow/tasks.mjs +7 -2
  20. package/dist-server/game-workflow/work-scope.mjs +7 -0
  21. package/dist-server/integrations/config.mjs +90 -16
  22. package/dist-server/integrations/connect.mjs +36 -0
  23. package/dist-server/integrations/connection-handoff.mjs +36 -0
  24. package/dist-server/integrations/dsh-config.mjs +182 -0
  25. package/dist-server/integrations/fixed-launcher.mjs +31 -0
  26. package/dist-server/integrations/host-reload.mjs +19 -0
  27. package/dist-server/integrations/hosts.mjs +27 -7
  28. package/dist-server/integrations/install.mjs +168 -31
  29. package/dist-server/integrations/installation-state.mjs +84 -0
  30. package/dist-server/integrations/launcher-start.mjs +52 -0
  31. package/dist-server/integrations/npm-diagnostics.mjs +32 -0
  32. package/dist-server/integrations/runtime-gc.mjs +191 -0
  33. package/dist-server/integrations/runtime-identity.mjs +22 -0
  34. package/dist-server/integrations/runtime.mjs +64 -25
  35. package/dist-server/integrations/updates.mjs +258 -0
  36. package/dist-server/integrations/version-policy.mjs +32 -0
  37. package/dist-server/launcher.mjs +1845 -0
  38. package/dist-server/mcp/control-panel.mjs +12 -24
  39. package/dist-server/mcp/server.mjs +150 -91
  40. package/dist-server/mcp/start.mjs +8 -2
  41. package/dist-server/mcp/update-session.mjs +107 -0
  42. package/dist-server/upstream/craft-aigc.mjs +43 -16
  43. package/dist-server/upstream/draft-source.mjs +29 -0
  44. package/package.json +4 -3
  45. package/resources/context-filter-report.json +177 -0
  46. package/resources/craft-create/SKILL.md +10 -2
  47. package/resources/craft-update/SKILL.md +23 -0
  48. package/resources/targets/claude/js/bootstrap/SKILL.md +20 -0
  49. package/resources/targets/claude/js/context-filter-report.json +27 -0
  50. package/resources/targets/claude/js/craft-game-maker/SKILL.md +72 -0
  51. package/resources/targets/claude/js/craft-game-maker/js.md +10 -0
  52. package/resources/targets/claude/js/js/bundle.json +97 -0
  53. package/resources/targets/claude/js/js/context/AGENTS.md +29 -0
  54. package/resources/targets/claude/js/js/context/hooks/hooks.json +14 -0
  55. package/resources/targets/claude/js/js/context/knowledge/AssetUrl.md +9 -0
  56. package/resources/targets/claude/js/js/context/knowledge/AssetWiring.md +7 -0
  57. package/resources/targets/claude/js/js/context/knowledge/Layout.md +7 -0
  58. package/resources/targets/claude/js/js/context/knowledge/Lifecycle.md +11 -0
  59. package/resources/targets/claude/js/js/context/knowledge/ResourceLoading.md +9 -0
  60. package/resources/targets/claude/js/js/context/skills/export-config/SKILL.md +16 -0
  61. package/resources/targets/claude/js/js/context/skills/export-config/assets/tooling/cli.mjs +20 -0
  62. package/resources/targets/claude/js/js/context/skills/export-config/assets/tooling/config.d.mts +19 -0
  63. package/resources/targets/claude/js/js/context/skills/export-config/assets/tooling/config.mjs +1 -0
  64. package/resources/targets/claude/js/js/context/skills/export-config/assets/tooling/project.d.mts +6 -0
  65. package/resources/targets/claude/js/js/context/skills/export-config/assets/tooling/project.mjs +77 -0
  66. package/resources/targets/claude/js/js/context/skills/export-config/assets/tooling/vite.d.mts +2 -0
  67. package/resources/targets/claude/js/js/context/skills/export-config/assets/tooling/vite.mjs +34 -0
  68. package/resources/targets/claude/js/js/context/skills/export-config/scripts/export-config.mjs +4 -0
  69. package/resources/targets/claude/js/js/context/skills/export-config/scripts/install.mjs +89 -0
  70. package/resources/targets/claude/js/js/context/skills/export-config/scripts/panel-resource-path.mjs +106 -0
  71. package/resources/targets/claude/js/js/context/skills/index.json +19 -0
  72. package/resources/targets/claude/js/js/context/skills/visual-qa/SKILL.md +14 -0
  73. package/resources/targets/claude/js/js/project/README.md +7 -0
  74. package/resources/targets/claude/js/js/project/configs/assets.json +1 -0
  75. package/resources/targets/claude/js/js/project/configs/game.controls.json +3 -0
  76. package/resources/targets/claude/js/js/project/configs/game.json +3 -0
  77. package/resources/targets/claude/js/js/project/game-runtime.json +7 -0
  78. package/resources/targets/claude/js/js/project/game.config.json +7 -0
  79. package/resources/targets/claude/js/js/project/index.html +20 -0
  80. package/resources/targets/claude/js/js/project/package.json +22 -0
  81. package/resources/targets/claude/js/js/project/runtime/lightgame/1.1.0/platform/identity/qq-ai-game-sdk.min.js +5 -0
  82. package/resources/targets/claude/js/js/project/runtime/lightgame/1.1.0/platform/identity/qq-session.mjs +208 -0
  83. package/resources/targets/claude/js/js/project/runtime/lightgame/1.1.0/platform/identity/shared.mjs +37 -0
  84. package/resources/targets/claude/js/js/project/runtime/lightgame/1.1.0/platform/platform-capture-video.mjs +227 -0
  85. package/resources/targets/claude/js/js/project/runtime/lightgame/1.1.0/platform/platform-service.d.mts +31 -0
  86. package/resources/targets/claude/js/js/project/runtime/lightgame/1.1.0/platform/platform-service.mjs +272 -0
  87. package/resources/targets/claude/js/js/project/runtime/lightgame/1.1.0/platform/platform.d.mts +79 -0
  88. package/resources/targets/claude/js/js/project/runtime/lightgame/1.1.0/platform/platform.mjs +29 -0
  89. package/resources/targets/claude/js/js/project/runtime/lightgame/1.1.0/release.json +22 -0
  90. package/resources/targets/claude/js/js/project/runtime/lightgame/1.1.0/tooling/cli.mjs +16 -0
  91. package/resources/targets/claude/js/js/project/runtime/lightgame/1.1.0/tooling/project.d.mts +4 -0
  92. package/resources/targets/claude/js/js/project/runtime/lightgame/1.1.0/tooling/project.mjs +50 -0
  93. package/resources/targets/claude/js/js/project/runtime/lightgame/1.1.0/tooling/vite.d.mts +3 -0
  94. package/resources/targets/claude/js/js/project/runtime/lightgame/1.1.0/tooling/vite.mjs +72 -0
  95. package/resources/targets/claude/js/js/project/runtime/lightgame/1.1.0/tools/assets.d.mts +24 -0
  96. package/resources/targets/claude/js/js/project/runtime/lightgame/1.1.0/tools/assets.mjs +2 -0
  97. package/resources/targets/claude/js/js/project/runtime/lightgame/1.1.0/tools/astc.d.mts +10 -0
  98. package/resources/targets/claude/js/js/project/runtime/lightgame/1.1.0/tools/astc.mjs +1 -0
  99. package/resources/targets/claude/js/js/project/scripts/config-export/assert-asset-wiring.mjs +72 -0
  100. package/resources/targets/claude/js/js/project/scripts/config-export/panel-resource-path.mjs +106 -0
  101. package/resources/targets/claude/js/js/project/scripts/config-export/sync-asset-controls.mjs +316 -0
  102. package/resources/targets/claude/js/js/project/scripts/config-export.mjs +13 -0
  103. package/resources/targets/claude/js/js/project/scripts/skill-modules/export-config/cli.mjs +20 -0
  104. package/resources/targets/claude/js/js/project/scripts/skill-modules/export-config/config.d.mts +19 -0
  105. package/resources/targets/claude/js/js/project/scripts/skill-modules/export-config/config.mjs +1 -0
  106. package/resources/targets/claude/js/js/project/scripts/skill-modules/export-config/installed.json +6 -0
  107. package/resources/targets/claude/js/js/project/scripts/skill-modules/export-config/project.d.mts +6 -0
  108. package/resources/targets/claude/js/js/project/scripts/skill-modules/export-config/project.mjs +77 -0
  109. package/resources/targets/claude/js/js/project/scripts/skill-modules/export-config/vite.d.mts +2 -0
  110. package/resources/targets/claude/js/js/project/scripts/skill-modules/export-config/vite.mjs +34 -0
  111. package/resources/targets/claude/js/js/project/scripts/write-preview-ready.mjs +22 -0
  112. package/resources/targets/claude/js/js/project/src/display/ui-stage.ts +156 -0
  113. package/resources/targets/claude/js/js/project/src/display/viewport.ts +249 -0
  114. package/resources/targets/claude/js/js/project/src/main.ts +87 -0
  115. package/resources/targets/claude/js/js/project/src/platform.ts +2 -0
  116. package/resources/targets/claude/js/js/project/src/scenes/LoadScene.ts +89 -0
  117. package/resources/targets/claude/js/js/project/src/scenes/PlayScene.ts +17 -0
  118. package/resources/targets/claude/js/js/project/src/screenUi.ts +185 -0
  119. package/resources/targets/claude/js/js/project/src/style.css +294 -0
  120. package/resources/targets/claude/js/js/project/tsconfig.json +20 -0
  121. package/resources/targets/claude/js/js/project/unified_data_control_config.json +20 -0
  122. package/resources/targets/claude/js/js/project/vite.config.ts +5 -0
  123. package/resources/targets/claude/js/recovery.md +17 -0
  124. package/resources/targets/claude/js/target.json +61 -0
  125. package/resources/targets/claude/js3d/bootstrap/SKILL.md +20 -0
  126. package/resources/targets/claude/js3d/context-filter-report.json +27 -0
  127. package/resources/targets/claude/js3d/craft-game-maker/SKILL.md +72 -0
  128. package/resources/targets/claude/js3d/craft-game-maker/js3d.md +12 -0
  129. package/resources/targets/claude/js3d/js3d/bundle.json +108 -0
  130. package/resources/targets/claude/js3d/js3d/context/AGENTS.md +30 -0
  131. package/resources/targets/claude/js3d/js3d/context/hooks/hooks.json +14 -0
  132. package/resources/targets/claude/js3d/js3d/context/knowledge/AssetUrl.md +9 -0
  133. package/resources/targets/claude/js3d/js3d/context/knowledge/AssetWiring.md +7 -0
  134. package/resources/targets/claude/js3d/js3d/context/knowledge/CodingGuide/Pitfalls.md +11 -0
  135. package/resources/targets/claude/js3d/js3d/context/knowledge/Layout.md +7 -0
  136. package/resources/targets/{workbuddy/js3d/js3d/context/skills/asset-search/references/resource-config.md → claude/js3d/js3d/context/knowledge/ResourceLoading.md} +2 -2
  137. package/resources/targets/claude/js3d/js3d/context/knowledge/Runtime.md +9 -0
  138. package/resources/targets/claude/js3d/js3d/context/skills/asset-usage-audit/SKILL.md +16 -0
  139. package/resources/targets/claude/js3d/js3d/context/skills/asset-usage-audit/scripts/compare-animations.mjs +48 -0
  140. package/resources/targets/claude/js3d/js3d/context/skills/asset-usage-audit/scripts/lib/anim.mjs +266 -0
  141. package/resources/targets/claude/js3d/js3d/context/skills/asset-usage-audit/scripts/lib/glb.mjs +241 -0
  142. package/resources/targets/claude/js3d/js3d/context/skills/asset-usage-audit/scripts/lib/scan.mjs +455 -0
  143. package/resources/targets/claude/js3d/js3d/context/skills/asset-usage-audit/scripts/scan-assets.mjs +77 -0
  144. package/resources/targets/claude/js3d/js3d/context/skills/export-config/SKILL.md +16 -0
  145. package/resources/targets/claude/js3d/js3d/context/skills/export-config/assets/tooling/cli.mjs +20 -0
  146. package/resources/targets/claude/js3d/js3d/context/skills/export-config/assets/tooling/config.d.mts +19 -0
  147. package/resources/targets/claude/js3d/js3d/context/skills/export-config/assets/tooling/config.mjs +1 -0
  148. package/resources/targets/claude/js3d/js3d/context/skills/export-config/assets/tooling/project.d.mts +6 -0
  149. package/resources/targets/claude/js3d/js3d/context/skills/export-config/assets/tooling/project.mjs +77 -0
  150. package/resources/targets/claude/js3d/js3d/context/skills/export-config/assets/tooling/vite.d.mts +2 -0
  151. package/resources/targets/claude/js3d/js3d/context/skills/export-config/assets/tooling/vite.mjs +34 -0
  152. package/resources/targets/claude/js3d/js3d/context/skills/export-config/scripts/export-config.mjs +4 -0
  153. package/resources/targets/claude/js3d/js3d/context/skills/export-config/scripts/install.mjs +89 -0
  154. package/resources/targets/claude/js3d/js3d/context/skills/export-config/scripts/panel-resource-path.mjs +106 -0
  155. package/resources/targets/claude/js3d/js3d/context/skills/index.json +31 -0
  156. package/resources/targets/claude/js3d/js3d/context/skills/performance-audit/SKILL.md +21 -0
  157. package/resources/targets/claude/js3d/js3d/context/skills/performance-audit/scripts/lib/rules.mjs +470 -0
  158. package/resources/targets/claude/js3d/js3d/context/skills/performance-audit/scripts/lib/scan.mjs +387 -0
  159. package/resources/targets/claude/js3d/js3d/context/skills/performance-audit/scripts/lib/source.mjs +398 -0
  160. package/resources/targets/claude/js3d/js3d/context/skills/performance-audit/scripts/scan-perf.mjs +130 -0
  161. package/resources/targets/claude/js3d/js3d/context/skills/visual-qa/SKILL.md +14 -0
  162. package/resources/targets/claude/js3d/js3d/project/README.md +7 -0
  163. package/resources/targets/claude/js3d/js3d/project/configs/game.controls.json +3 -0
  164. package/resources/targets/claude/js3d/js3d/project/configs/game.json +3 -0
  165. package/resources/targets/claude/js3d/js3d/project/game-runtime.json +7 -0
  166. package/resources/targets/claude/js3d/js3d/project/game.config.json +7 -0
  167. package/resources/targets/claude/js3d/js3d/project/index.html +12 -0
  168. package/resources/targets/claude/js3d/js3d/project/package.json +23 -0
  169. package/resources/targets/claude/js3d/js3d/project/runtime/lightgame/1.1.0/platform/identity/qq-ai-game-sdk.min.js +5 -0
  170. package/resources/targets/claude/js3d/js3d/project/runtime/lightgame/1.1.0/platform/identity/qq-session.mjs +208 -0
  171. package/resources/targets/claude/js3d/js3d/project/runtime/lightgame/1.1.0/platform/identity/shared.mjs +37 -0
  172. package/resources/targets/claude/js3d/js3d/project/runtime/lightgame/1.1.0/platform/platform-capture-video.mjs +227 -0
  173. package/resources/targets/claude/js3d/js3d/project/runtime/lightgame/1.1.0/platform/platform-service.d.mts +31 -0
  174. package/resources/targets/claude/js3d/js3d/project/runtime/lightgame/1.1.0/platform/platform-service.mjs +272 -0
  175. package/resources/targets/claude/js3d/js3d/project/runtime/lightgame/1.1.0/platform/platform.d.mts +79 -0
  176. package/resources/targets/claude/js3d/js3d/project/runtime/lightgame/1.1.0/platform/platform.mjs +30 -0
  177. package/resources/targets/claude/js3d/js3d/project/runtime/lightgame/1.1.0/release.json +24 -0
  178. package/resources/targets/claude/js3d/js3d/project/runtime/lightgame/1.1.0/tooling/cli.mjs +16 -0
  179. package/resources/targets/claude/js3d/js3d/project/runtime/lightgame/1.1.0/tooling/project.d.mts +4 -0
  180. package/resources/targets/claude/js3d/js3d/project/runtime/lightgame/1.1.0/tooling/project.mjs +50 -0
  181. package/resources/targets/claude/js3d/js3d/project/runtime/lightgame/1.1.0/tooling/vite.d.mts +3 -0
  182. package/resources/targets/claude/js3d/js3d/project/runtime/lightgame/1.1.0/tooling/vite.mjs +72 -0
  183. package/resources/targets/claude/js3d/js3d/project/runtime/lightgame/1.1.0/tools/assets.d.mts +24 -0
  184. package/resources/targets/claude/js3d/js3d/project/runtime/lightgame/1.1.0/tools/assets.mjs +2 -0
  185. package/resources/targets/claude/js3d/js3d/project/runtime/lightgame/1.1.0/tools/astc.d.mts +10 -0
  186. package/resources/targets/claude/js3d/js3d/project/runtime/lightgame/1.1.0/tools/astc.mjs +1 -0
  187. package/resources/targets/claude/js3d/js3d/project/runtime/lightgame/1.1.0/tools/glb.d.mts +26 -0
  188. package/resources/targets/claude/js3d/js3d/project/runtime/lightgame/1.1.0/tools/glb.mjs +351 -0
  189. package/resources/targets/claude/js3d/js3d/project/scripts/config-export/assert-asset-wiring.mjs +97 -0
  190. package/resources/targets/claude/js3d/js3d/project/scripts/config-export/panel-resource-path.mjs +106 -0
  191. package/resources/targets/claude/js3d/js3d/project/scripts/config-export/sync-asset-controls.mjs +327 -0
  192. package/resources/targets/claude/js3d/js3d/project/scripts/config-export/sync-scene-assets.mjs +191 -0
  193. package/resources/targets/claude/js3d/js3d/project/scripts/config-export.mjs +15 -0
  194. package/resources/targets/claude/js3d/js3d/project/scripts/skill-modules/export-config/cli.mjs +20 -0
  195. package/resources/targets/claude/js3d/js3d/project/scripts/skill-modules/export-config/config.d.mts +19 -0
  196. package/resources/targets/claude/js3d/js3d/project/scripts/skill-modules/export-config/config.mjs +1 -0
  197. package/resources/targets/claude/js3d/js3d/project/scripts/skill-modules/export-config/installed.json +6 -0
  198. package/resources/targets/claude/js3d/js3d/project/scripts/skill-modules/export-config/project.d.mts +6 -0
  199. package/resources/targets/claude/js3d/js3d/project/scripts/skill-modules/export-config/project.mjs +77 -0
  200. package/resources/targets/claude/js3d/js3d/project/scripts/skill-modules/export-config/vite.d.mts +2 -0
  201. package/resources/targets/claude/js3d/js3d/project/scripts/skill-modules/export-config/vite.mjs +34 -0
  202. package/resources/targets/claude/js3d/js3d/project/scripts/write-preview-ready.mjs +22 -0
  203. package/resources/targets/claude/js3d/js3d/project/src/display/ui-stage.ts +156 -0
  204. package/resources/targets/claude/js3d/js3d/project/src/display/viewport.ts +239 -0
  205. package/resources/targets/claude/js3d/js3d/project/src/main.ts +85 -0
  206. package/resources/targets/claude/js3d/js3d/project/src/platform.ts +2 -0
  207. package/resources/targets/claude/js3d/js3d/project/src/style.css +83 -0
  208. package/resources/targets/claude/js3d/js3d/project/tsconfig.json +20 -0
  209. package/resources/targets/claude/js3d/js3d/project/unified_data_control_config.json +20 -0
  210. package/resources/targets/claude/js3d/js3d/project/vite.config.ts +5 -0
  211. package/resources/targets/claude/js3d/recovery.md +17 -0
  212. package/resources/targets/claude/js3d/target.json +60 -0
  213. package/resources/targets/codebuddy/js/bootstrap/SKILL.md +7 -1
  214. package/resources/targets/codebuddy/js/context-filter-report.json +27 -0
  215. package/resources/targets/codebuddy/js/craft-game-maker/SKILL.md +24 -29
  216. package/resources/targets/codebuddy/js/craft-game-maker/js.md +2 -2
  217. package/resources/targets/codebuddy/js/js/bundle.json +16 -18
  218. package/resources/targets/codebuddy/js/js/context/AGENTS.md +10 -6
  219. package/resources/targets/codebuddy/js/js/context/knowledge/AssetUrl.md +4 -4
  220. package/resources/targets/codebuddy/js/js/context/knowledge/AssetWiring.md +7 -0
  221. package/resources/targets/codebuddy/js/js/context/knowledge/ResourceLoading.md +9 -0
  222. package/resources/targets/codebuddy/js/js/context/skills/export-config/SKILL.md +2 -2
  223. package/resources/targets/codebuddy/js/js/context/skills/index.json +2 -14
  224. package/resources/targets/codebuddy/js/js/context/skills/visual-qa/SKILL.md +1 -1
  225. package/resources/targets/codebuddy/js/recovery.md +14 -4
  226. package/resources/targets/codebuddy/js/target.json +1 -1
  227. package/resources/targets/codebuddy/js3d/bootstrap/SKILL.md +7 -1
  228. package/resources/targets/codebuddy/js3d/context-filter-report.json +27 -0
  229. package/resources/targets/codebuddy/js3d/craft-game-maker/SKILL.md +24 -29
  230. package/resources/targets/codebuddy/js3d/craft-game-maker/js3d.md +3 -4
  231. package/resources/targets/codebuddy/js3d/js3d/bundle.json +19 -21
  232. package/resources/targets/codebuddy/js3d/js3d/context/AGENTS.md +10 -6
  233. package/resources/targets/codebuddy/js3d/js3d/context/knowledge/AssetUrl.md +4 -4
  234. package/resources/targets/codebuddy/js3d/js3d/context/knowledge/AssetWiring.md +7 -0
  235. package/resources/targets/{codex/js3d/js3d/context/skills/asset-search/references/resource-config.md → codebuddy/js3d/js3d/context/knowledge/ResourceLoading.md} +2 -2
  236. package/resources/targets/codebuddy/js3d/js3d/context/skills/asset-usage-audit/SKILL.md +1 -1
  237. package/resources/targets/codebuddy/js3d/js3d/context/skills/asset-usage-audit/scripts/lib/scan.mjs +2 -2
  238. package/resources/targets/codebuddy/js3d/js3d/context/skills/export-config/SKILL.md +2 -2
  239. package/resources/targets/codebuddy/js3d/js3d/context/skills/index.json +4 -16
  240. package/resources/targets/codebuddy/js3d/js3d/context/skills/performance-audit/SKILL.md +1 -1
  241. package/resources/targets/codebuddy/js3d/js3d/context/skills/visual-qa/SKILL.md +1 -1
  242. package/resources/targets/codebuddy/js3d/recovery.md +14 -4
  243. package/resources/targets/codebuddy/js3d/target.json +1 -1
  244. package/resources/targets/codex/js/bootstrap/SKILL.md +7 -1
  245. package/resources/targets/codex/js/context-filter-report.json +27 -0
  246. package/resources/targets/codex/js/craft-game-maker/SKILL.md +24 -29
  247. package/resources/targets/codex/js/craft-game-maker/js.md +2 -2
  248. package/resources/targets/codex/js/js/bundle.json +16 -18
  249. package/resources/targets/codex/js/js/context/AGENTS.md +10 -6
  250. package/resources/targets/codex/js/js/context/knowledge/AssetUrl.md +4 -4
  251. package/resources/targets/codex/js/js/context/knowledge/AssetWiring.md +7 -0
  252. package/resources/targets/codex/js/js/context/knowledge/ResourceLoading.md +9 -0
  253. package/resources/targets/codex/js/js/context/skills/export-config/SKILL.md +2 -2
  254. package/resources/targets/codex/js/js/context/skills/index.json +2 -14
  255. package/resources/targets/codex/js/js/context/skills/visual-qa/SKILL.md +1 -1
  256. package/resources/targets/codex/js/recovery.md +14 -4
  257. package/resources/targets/codex/js/target.json +1 -1
  258. package/resources/targets/codex/js3d/bootstrap/SKILL.md +7 -1
  259. package/resources/targets/codex/js3d/context-filter-report.json +27 -0
  260. package/resources/targets/codex/js3d/craft-game-maker/SKILL.md +24 -29
  261. package/resources/targets/codex/js3d/craft-game-maker/js3d.md +3 -4
  262. package/resources/targets/codex/js3d/js3d/bundle.json +19 -21
  263. package/resources/targets/codex/js3d/js3d/context/AGENTS.md +10 -6
  264. package/resources/targets/codex/js3d/js3d/context/knowledge/AssetUrl.md +4 -4
  265. package/resources/targets/codex/js3d/js3d/context/knowledge/AssetWiring.md +7 -0
  266. package/resources/targets/{codebuddy/js3d/js3d/context/skills/asset-search/references/resource-config.md → codex/js3d/js3d/context/knowledge/ResourceLoading.md} +2 -2
  267. package/resources/targets/codex/js3d/js3d/context/skills/asset-usage-audit/SKILL.md +1 -1
  268. package/resources/targets/codex/js3d/js3d/context/skills/asset-usage-audit/scripts/lib/scan.mjs +2 -2
  269. package/resources/targets/codex/js3d/js3d/context/skills/export-config/SKILL.md +2 -2
  270. package/resources/targets/codex/js3d/js3d/context/skills/index.json +4 -16
  271. package/resources/targets/codex/js3d/js3d/context/skills/performance-audit/SKILL.md +1 -1
  272. package/resources/targets/codex/js3d/js3d/context/skills/visual-qa/SKILL.md +1 -1
  273. package/resources/targets/codex/js3d/recovery.md +14 -4
  274. package/resources/targets/codex/js3d/target.json +1 -1
  275. package/resources/targets/cursor/js/bootstrap/SKILL.md +20 -0
  276. package/resources/targets/cursor/js/context-filter-report.json +27 -0
  277. package/resources/targets/cursor/js/craft-game-maker/SKILL.md +72 -0
  278. package/resources/targets/cursor/js/craft-game-maker/js.md +10 -0
  279. package/resources/targets/cursor/js/js/bundle.json +97 -0
  280. package/resources/targets/cursor/js/js/context/AGENTS.md +29 -0
  281. package/resources/targets/cursor/js/js/context/hooks/hooks.json +14 -0
  282. package/resources/targets/cursor/js/js/context/knowledge/AssetUrl.md +9 -0
  283. package/resources/targets/cursor/js/js/context/knowledge/AssetWiring.md +7 -0
  284. package/resources/targets/cursor/js/js/context/knowledge/Layout.md +7 -0
  285. package/resources/targets/cursor/js/js/context/knowledge/Lifecycle.md +11 -0
  286. package/resources/targets/cursor/js/js/context/knowledge/ResourceLoading.md +9 -0
  287. package/resources/targets/cursor/js/js/context/skills/export-config/SKILL.md +16 -0
  288. package/resources/targets/cursor/js/js/context/skills/export-config/assets/tooling/cli.mjs +20 -0
  289. package/resources/targets/cursor/js/js/context/skills/export-config/assets/tooling/config.d.mts +19 -0
  290. package/resources/targets/cursor/js/js/context/skills/export-config/assets/tooling/config.mjs +1 -0
  291. package/resources/targets/cursor/js/js/context/skills/export-config/assets/tooling/project.d.mts +6 -0
  292. package/resources/targets/cursor/js/js/context/skills/export-config/assets/tooling/project.mjs +77 -0
  293. package/resources/targets/cursor/js/js/context/skills/export-config/assets/tooling/vite.d.mts +2 -0
  294. package/resources/targets/cursor/js/js/context/skills/export-config/assets/tooling/vite.mjs +34 -0
  295. package/resources/targets/cursor/js/js/context/skills/export-config/scripts/export-config.mjs +4 -0
  296. package/resources/targets/cursor/js/js/context/skills/export-config/scripts/install.mjs +89 -0
  297. package/resources/targets/cursor/js/js/context/skills/export-config/scripts/panel-resource-path.mjs +106 -0
  298. package/resources/targets/cursor/js/js/context/skills/index.json +19 -0
  299. package/resources/targets/cursor/js/js/context/skills/visual-qa/SKILL.md +14 -0
  300. package/resources/targets/cursor/js/js/project/README.md +7 -0
  301. package/resources/targets/cursor/js/js/project/configs/assets.json +1 -0
  302. package/resources/targets/cursor/js/js/project/configs/game.controls.json +3 -0
  303. package/resources/targets/cursor/js/js/project/configs/game.json +3 -0
  304. package/resources/targets/cursor/js/js/project/game-runtime.json +7 -0
  305. package/resources/targets/cursor/js/js/project/game.config.json +7 -0
  306. package/resources/targets/cursor/js/js/project/index.html +20 -0
  307. package/resources/targets/cursor/js/js/project/package.json +22 -0
  308. package/resources/targets/cursor/js/js/project/runtime/lightgame/1.1.0/platform/identity/qq-ai-game-sdk.min.js +5 -0
  309. package/resources/targets/cursor/js/js/project/runtime/lightgame/1.1.0/platform/identity/qq-session.mjs +208 -0
  310. package/resources/targets/cursor/js/js/project/runtime/lightgame/1.1.0/platform/identity/shared.mjs +37 -0
  311. package/resources/targets/cursor/js/js/project/runtime/lightgame/1.1.0/platform/platform-capture-video.mjs +227 -0
  312. package/resources/targets/cursor/js/js/project/runtime/lightgame/1.1.0/platform/platform-service.d.mts +31 -0
  313. package/resources/targets/cursor/js/js/project/runtime/lightgame/1.1.0/platform/platform-service.mjs +272 -0
  314. package/resources/targets/cursor/js/js/project/runtime/lightgame/1.1.0/platform/platform.d.mts +79 -0
  315. package/resources/targets/cursor/js/js/project/runtime/lightgame/1.1.0/platform/platform.mjs +29 -0
  316. package/resources/targets/cursor/js/js/project/runtime/lightgame/1.1.0/release.json +22 -0
  317. package/resources/targets/cursor/js/js/project/runtime/lightgame/1.1.0/tooling/cli.mjs +16 -0
  318. package/resources/targets/cursor/js/js/project/runtime/lightgame/1.1.0/tooling/project.d.mts +4 -0
  319. package/resources/targets/cursor/js/js/project/runtime/lightgame/1.1.0/tooling/project.mjs +50 -0
  320. package/resources/targets/cursor/js/js/project/runtime/lightgame/1.1.0/tooling/vite.d.mts +3 -0
  321. package/resources/targets/cursor/js/js/project/runtime/lightgame/1.1.0/tooling/vite.mjs +72 -0
  322. package/resources/targets/cursor/js/js/project/runtime/lightgame/1.1.0/tools/assets.d.mts +24 -0
  323. package/resources/targets/cursor/js/js/project/runtime/lightgame/1.1.0/tools/assets.mjs +2 -0
  324. package/resources/targets/cursor/js/js/project/runtime/lightgame/1.1.0/tools/astc.d.mts +10 -0
  325. package/resources/targets/cursor/js/js/project/runtime/lightgame/1.1.0/tools/astc.mjs +1 -0
  326. package/resources/targets/cursor/js/js/project/scripts/config-export/assert-asset-wiring.mjs +72 -0
  327. package/resources/targets/cursor/js/js/project/scripts/config-export/panel-resource-path.mjs +106 -0
  328. package/resources/targets/cursor/js/js/project/scripts/config-export/sync-asset-controls.mjs +316 -0
  329. package/resources/targets/cursor/js/js/project/scripts/config-export.mjs +13 -0
  330. package/resources/targets/cursor/js/js/project/scripts/skill-modules/export-config/cli.mjs +20 -0
  331. package/resources/targets/cursor/js/js/project/scripts/skill-modules/export-config/config.d.mts +19 -0
  332. package/resources/targets/cursor/js/js/project/scripts/skill-modules/export-config/config.mjs +1 -0
  333. package/resources/targets/cursor/js/js/project/scripts/skill-modules/export-config/installed.json +6 -0
  334. package/resources/targets/cursor/js/js/project/scripts/skill-modules/export-config/project.d.mts +6 -0
  335. package/resources/targets/cursor/js/js/project/scripts/skill-modules/export-config/project.mjs +77 -0
  336. package/resources/targets/cursor/js/js/project/scripts/skill-modules/export-config/vite.d.mts +2 -0
  337. package/resources/targets/cursor/js/js/project/scripts/skill-modules/export-config/vite.mjs +34 -0
  338. package/resources/targets/cursor/js/js/project/scripts/write-preview-ready.mjs +22 -0
  339. package/resources/targets/cursor/js/js/project/src/display/ui-stage.ts +156 -0
  340. package/resources/targets/cursor/js/js/project/src/display/viewport.ts +249 -0
  341. package/resources/targets/cursor/js/js/project/src/main.ts +87 -0
  342. package/resources/targets/cursor/js/js/project/src/platform.ts +2 -0
  343. package/resources/targets/cursor/js/js/project/src/scenes/LoadScene.ts +89 -0
  344. package/resources/targets/cursor/js/js/project/src/scenes/PlayScene.ts +17 -0
  345. package/resources/targets/cursor/js/js/project/src/screenUi.ts +185 -0
  346. package/resources/targets/cursor/js/js/project/src/style.css +294 -0
  347. package/resources/targets/cursor/js/js/project/tsconfig.json +20 -0
  348. package/resources/targets/cursor/js/js/project/unified_data_control_config.json +20 -0
  349. package/resources/targets/cursor/js/js/project/vite.config.ts +5 -0
  350. package/resources/targets/cursor/js/recovery.md +17 -0
  351. package/resources/targets/cursor/js/target.json +61 -0
  352. package/resources/targets/cursor/js3d/bootstrap/SKILL.md +20 -0
  353. package/resources/targets/cursor/js3d/context-filter-report.json +27 -0
  354. package/resources/targets/cursor/js3d/craft-game-maker/SKILL.md +72 -0
  355. package/resources/targets/cursor/js3d/craft-game-maker/js3d.md +12 -0
  356. package/resources/targets/cursor/js3d/js3d/bundle.json +108 -0
  357. package/resources/targets/cursor/js3d/js3d/context/AGENTS.md +30 -0
  358. package/resources/targets/cursor/js3d/js3d/context/hooks/hooks.json +14 -0
  359. package/resources/targets/cursor/js3d/js3d/context/knowledge/AssetUrl.md +9 -0
  360. package/resources/targets/cursor/js3d/js3d/context/knowledge/AssetWiring.md +7 -0
  361. package/resources/targets/cursor/js3d/js3d/context/knowledge/CodingGuide/Pitfalls.md +11 -0
  362. package/resources/targets/cursor/js3d/js3d/context/knowledge/Layout.md +7 -0
  363. package/resources/targets/cursor/js3d/js3d/context/knowledge/ResourceLoading.md +11 -0
  364. package/resources/targets/cursor/js3d/js3d/context/knowledge/Runtime.md +9 -0
  365. package/resources/targets/cursor/js3d/js3d/context/skills/asset-usage-audit/SKILL.md +16 -0
  366. package/resources/targets/cursor/js3d/js3d/context/skills/asset-usage-audit/scripts/compare-animations.mjs +48 -0
  367. package/resources/targets/cursor/js3d/js3d/context/skills/asset-usage-audit/scripts/lib/anim.mjs +266 -0
  368. package/resources/targets/cursor/js3d/js3d/context/skills/asset-usage-audit/scripts/lib/glb.mjs +241 -0
  369. package/resources/targets/cursor/js3d/js3d/context/skills/asset-usage-audit/scripts/lib/scan.mjs +455 -0
  370. package/resources/targets/cursor/js3d/js3d/context/skills/asset-usage-audit/scripts/scan-assets.mjs +77 -0
  371. package/resources/targets/cursor/js3d/js3d/context/skills/export-config/SKILL.md +16 -0
  372. package/resources/targets/cursor/js3d/js3d/context/skills/export-config/assets/tooling/cli.mjs +20 -0
  373. package/resources/targets/cursor/js3d/js3d/context/skills/export-config/assets/tooling/config.d.mts +19 -0
  374. package/resources/targets/cursor/js3d/js3d/context/skills/export-config/assets/tooling/config.mjs +1 -0
  375. package/resources/targets/cursor/js3d/js3d/context/skills/export-config/assets/tooling/project.d.mts +6 -0
  376. package/resources/targets/cursor/js3d/js3d/context/skills/export-config/assets/tooling/project.mjs +77 -0
  377. package/resources/targets/cursor/js3d/js3d/context/skills/export-config/assets/tooling/vite.d.mts +2 -0
  378. package/resources/targets/cursor/js3d/js3d/context/skills/export-config/assets/tooling/vite.mjs +34 -0
  379. package/resources/targets/cursor/js3d/js3d/context/skills/export-config/scripts/export-config.mjs +4 -0
  380. package/resources/targets/cursor/js3d/js3d/context/skills/export-config/scripts/install.mjs +89 -0
  381. package/resources/targets/cursor/js3d/js3d/context/skills/export-config/scripts/panel-resource-path.mjs +106 -0
  382. package/resources/targets/cursor/js3d/js3d/context/skills/index.json +31 -0
  383. package/resources/targets/cursor/js3d/js3d/context/skills/performance-audit/SKILL.md +21 -0
  384. package/resources/targets/cursor/js3d/js3d/context/skills/performance-audit/scripts/lib/rules.mjs +470 -0
  385. package/resources/targets/cursor/js3d/js3d/context/skills/performance-audit/scripts/lib/scan.mjs +387 -0
  386. package/resources/targets/cursor/js3d/js3d/context/skills/performance-audit/scripts/lib/source.mjs +398 -0
  387. package/resources/targets/cursor/js3d/js3d/context/skills/performance-audit/scripts/scan-perf.mjs +130 -0
  388. package/resources/targets/cursor/js3d/js3d/context/skills/visual-qa/SKILL.md +14 -0
  389. package/resources/targets/cursor/js3d/js3d/project/README.md +7 -0
  390. package/resources/targets/cursor/js3d/js3d/project/configs/game.controls.json +3 -0
  391. package/resources/targets/cursor/js3d/js3d/project/configs/game.json +3 -0
  392. package/resources/targets/cursor/js3d/js3d/project/game-runtime.json +7 -0
  393. package/resources/targets/cursor/js3d/js3d/project/game.config.json +7 -0
  394. package/resources/targets/cursor/js3d/js3d/project/index.html +12 -0
  395. package/resources/targets/cursor/js3d/js3d/project/package.json +23 -0
  396. package/resources/targets/cursor/js3d/js3d/project/runtime/lightgame/1.1.0/platform/identity/qq-ai-game-sdk.min.js +5 -0
  397. package/resources/targets/cursor/js3d/js3d/project/runtime/lightgame/1.1.0/platform/identity/qq-session.mjs +208 -0
  398. package/resources/targets/cursor/js3d/js3d/project/runtime/lightgame/1.1.0/platform/identity/shared.mjs +37 -0
  399. package/resources/targets/cursor/js3d/js3d/project/runtime/lightgame/1.1.0/platform/platform-capture-video.mjs +227 -0
  400. package/resources/targets/cursor/js3d/js3d/project/runtime/lightgame/1.1.0/platform/platform-service.d.mts +31 -0
  401. package/resources/targets/cursor/js3d/js3d/project/runtime/lightgame/1.1.0/platform/platform-service.mjs +272 -0
  402. package/resources/targets/cursor/js3d/js3d/project/runtime/lightgame/1.1.0/platform/platform.d.mts +79 -0
  403. package/resources/targets/cursor/js3d/js3d/project/runtime/lightgame/1.1.0/platform/platform.mjs +30 -0
  404. package/resources/targets/cursor/js3d/js3d/project/runtime/lightgame/1.1.0/release.json +24 -0
  405. package/resources/targets/cursor/js3d/js3d/project/runtime/lightgame/1.1.0/tooling/cli.mjs +16 -0
  406. package/resources/targets/cursor/js3d/js3d/project/runtime/lightgame/1.1.0/tooling/project.d.mts +4 -0
  407. package/resources/targets/cursor/js3d/js3d/project/runtime/lightgame/1.1.0/tooling/project.mjs +50 -0
  408. package/resources/targets/cursor/js3d/js3d/project/runtime/lightgame/1.1.0/tooling/vite.d.mts +3 -0
  409. package/resources/targets/cursor/js3d/js3d/project/runtime/lightgame/1.1.0/tooling/vite.mjs +72 -0
  410. package/resources/targets/cursor/js3d/js3d/project/runtime/lightgame/1.1.0/tools/assets.d.mts +24 -0
  411. package/resources/targets/cursor/js3d/js3d/project/runtime/lightgame/1.1.0/tools/assets.mjs +2 -0
  412. package/resources/targets/cursor/js3d/js3d/project/runtime/lightgame/1.1.0/tools/astc.d.mts +10 -0
  413. package/resources/targets/cursor/js3d/js3d/project/runtime/lightgame/1.1.0/tools/astc.mjs +1 -0
  414. package/resources/targets/cursor/js3d/js3d/project/runtime/lightgame/1.1.0/tools/glb.d.mts +26 -0
  415. package/resources/targets/cursor/js3d/js3d/project/runtime/lightgame/1.1.0/tools/glb.mjs +351 -0
  416. package/resources/targets/cursor/js3d/js3d/project/scripts/config-export/assert-asset-wiring.mjs +97 -0
  417. package/resources/targets/cursor/js3d/js3d/project/scripts/config-export/panel-resource-path.mjs +106 -0
  418. package/resources/targets/cursor/js3d/js3d/project/scripts/config-export/sync-asset-controls.mjs +327 -0
  419. package/resources/targets/cursor/js3d/js3d/project/scripts/config-export/sync-scene-assets.mjs +191 -0
  420. package/resources/targets/cursor/js3d/js3d/project/scripts/config-export.mjs +15 -0
  421. package/resources/targets/cursor/js3d/js3d/project/scripts/skill-modules/export-config/cli.mjs +20 -0
  422. package/resources/targets/cursor/js3d/js3d/project/scripts/skill-modules/export-config/config.d.mts +19 -0
  423. package/resources/targets/cursor/js3d/js3d/project/scripts/skill-modules/export-config/config.mjs +1 -0
  424. package/resources/targets/cursor/js3d/js3d/project/scripts/skill-modules/export-config/installed.json +6 -0
  425. package/resources/targets/cursor/js3d/js3d/project/scripts/skill-modules/export-config/project.d.mts +6 -0
  426. package/resources/targets/cursor/js3d/js3d/project/scripts/skill-modules/export-config/project.mjs +77 -0
  427. package/resources/targets/cursor/js3d/js3d/project/scripts/skill-modules/export-config/vite.d.mts +2 -0
  428. package/resources/targets/cursor/js3d/js3d/project/scripts/skill-modules/export-config/vite.mjs +34 -0
  429. package/resources/targets/cursor/js3d/js3d/project/scripts/write-preview-ready.mjs +22 -0
  430. package/resources/targets/cursor/js3d/js3d/project/src/display/ui-stage.ts +156 -0
  431. package/resources/targets/cursor/js3d/js3d/project/src/display/viewport.ts +239 -0
  432. package/resources/targets/cursor/js3d/js3d/project/src/main.ts +85 -0
  433. package/resources/targets/cursor/js3d/js3d/project/src/platform.ts +2 -0
  434. package/resources/targets/cursor/js3d/js3d/project/src/style.css +83 -0
  435. package/resources/targets/cursor/js3d/js3d/project/tsconfig.json +20 -0
  436. package/resources/targets/cursor/js3d/js3d/project/unified_data_control_config.json +20 -0
  437. package/resources/targets/cursor/js3d/js3d/project/vite.config.ts +5 -0
  438. package/resources/targets/cursor/js3d/recovery.md +17 -0
  439. package/resources/targets/cursor/js3d/target.json +60 -0
  440. package/resources/targets/dsh/js/bootstrap/SKILL.md +20 -0
  441. package/resources/targets/dsh/js/context-filter-report.json +27 -0
  442. package/resources/targets/dsh/js/craft-game-maker/SKILL.md +72 -0
  443. package/resources/targets/dsh/js/craft-game-maker/js.md +10 -0
  444. package/resources/targets/dsh/js/js/bundle.json +97 -0
  445. package/resources/targets/dsh/js/js/context/AGENTS.md +29 -0
  446. package/resources/targets/dsh/js/js/context/hooks/hooks.json +14 -0
  447. package/resources/targets/dsh/js/js/context/knowledge/AssetUrl.md +9 -0
  448. package/resources/targets/dsh/js/js/context/knowledge/AssetWiring.md +7 -0
  449. package/resources/targets/dsh/js/js/context/knowledge/Layout.md +7 -0
  450. package/resources/targets/dsh/js/js/context/knowledge/Lifecycle.md +11 -0
  451. package/resources/targets/dsh/js/js/context/knowledge/ResourceLoading.md +9 -0
  452. package/resources/targets/dsh/js/js/context/skills/export-config/SKILL.md +16 -0
  453. package/resources/targets/dsh/js/js/context/skills/export-config/assets/tooling/cli.mjs +20 -0
  454. package/resources/targets/dsh/js/js/context/skills/export-config/assets/tooling/config.d.mts +19 -0
  455. package/resources/targets/dsh/js/js/context/skills/export-config/assets/tooling/config.mjs +1 -0
  456. package/resources/targets/dsh/js/js/context/skills/export-config/assets/tooling/project.d.mts +6 -0
  457. package/resources/targets/dsh/js/js/context/skills/export-config/assets/tooling/project.mjs +77 -0
  458. package/resources/targets/dsh/js/js/context/skills/export-config/assets/tooling/vite.d.mts +2 -0
  459. package/resources/targets/dsh/js/js/context/skills/export-config/assets/tooling/vite.mjs +34 -0
  460. package/resources/targets/dsh/js/js/context/skills/export-config/scripts/export-config.mjs +4 -0
  461. package/resources/targets/dsh/js/js/context/skills/export-config/scripts/install.mjs +89 -0
  462. package/resources/targets/dsh/js/js/context/skills/export-config/scripts/panel-resource-path.mjs +106 -0
  463. package/resources/targets/dsh/js/js/context/skills/index.json +19 -0
  464. package/resources/targets/dsh/js/js/context/skills/visual-qa/SKILL.md +14 -0
  465. package/resources/targets/dsh/js/js/project/README.md +7 -0
  466. package/resources/targets/dsh/js/js/project/configs/assets.json +1 -0
  467. package/resources/targets/dsh/js/js/project/configs/game.controls.json +3 -0
  468. package/resources/targets/dsh/js/js/project/configs/game.json +3 -0
  469. package/resources/targets/dsh/js/js/project/game-runtime.json +7 -0
  470. package/resources/targets/dsh/js/js/project/game.config.json +7 -0
  471. package/resources/targets/dsh/js/js/project/index.html +20 -0
  472. package/resources/targets/dsh/js/js/project/package.json +22 -0
  473. package/resources/targets/dsh/js/js/project/runtime/lightgame/1.1.0/platform/identity/qq-ai-game-sdk.min.js +5 -0
  474. package/resources/targets/dsh/js/js/project/runtime/lightgame/1.1.0/platform/identity/qq-session.mjs +208 -0
  475. package/resources/targets/dsh/js/js/project/runtime/lightgame/1.1.0/platform/identity/shared.mjs +37 -0
  476. package/resources/targets/dsh/js/js/project/runtime/lightgame/1.1.0/platform/platform-capture-video.mjs +227 -0
  477. package/resources/targets/dsh/js/js/project/runtime/lightgame/1.1.0/platform/platform-service.d.mts +31 -0
  478. package/resources/targets/dsh/js/js/project/runtime/lightgame/1.1.0/platform/platform-service.mjs +272 -0
  479. package/resources/targets/dsh/js/js/project/runtime/lightgame/1.1.0/platform/platform.d.mts +79 -0
  480. package/resources/targets/dsh/js/js/project/runtime/lightgame/1.1.0/platform/platform.mjs +29 -0
  481. package/resources/targets/dsh/js/js/project/runtime/lightgame/1.1.0/release.json +22 -0
  482. package/resources/targets/dsh/js/js/project/runtime/lightgame/1.1.0/tooling/cli.mjs +16 -0
  483. package/resources/targets/dsh/js/js/project/runtime/lightgame/1.1.0/tooling/project.d.mts +4 -0
  484. package/resources/targets/dsh/js/js/project/runtime/lightgame/1.1.0/tooling/project.mjs +50 -0
  485. package/resources/targets/dsh/js/js/project/runtime/lightgame/1.1.0/tooling/vite.d.mts +3 -0
  486. package/resources/targets/dsh/js/js/project/runtime/lightgame/1.1.0/tooling/vite.mjs +72 -0
  487. package/resources/targets/dsh/js/js/project/runtime/lightgame/1.1.0/tools/assets.d.mts +24 -0
  488. package/resources/targets/dsh/js/js/project/runtime/lightgame/1.1.0/tools/assets.mjs +2 -0
  489. package/resources/targets/dsh/js/js/project/runtime/lightgame/1.1.0/tools/astc.d.mts +10 -0
  490. package/resources/targets/dsh/js/js/project/runtime/lightgame/1.1.0/tools/astc.mjs +1 -0
  491. package/resources/targets/dsh/js/js/project/scripts/config-export/assert-asset-wiring.mjs +72 -0
  492. package/resources/targets/dsh/js/js/project/scripts/config-export/panel-resource-path.mjs +106 -0
  493. package/resources/targets/dsh/js/js/project/scripts/config-export/sync-asset-controls.mjs +316 -0
  494. package/resources/targets/dsh/js/js/project/scripts/config-export.mjs +13 -0
  495. package/resources/targets/dsh/js/js/project/scripts/skill-modules/export-config/cli.mjs +20 -0
  496. package/resources/targets/dsh/js/js/project/scripts/skill-modules/export-config/config.d.mts +19 -0
  497. package/resources/targets/dsh/js/js/project/scripts/skill-modules/export-config/config.mjs +1 -0
  498. package/resources/targets/dsh/js/js/project/scripts/skill-modules/export-config/installed.json +6 -0
  499. package/resources/targets/dsh/js/js/project/scripts/skill-modules/export-config/project.d.mts +6 -0
  500. package/resources/targets/dsh/js/js/project/scripts/skill-modules/export-config/project.mjs +77 -0
  501. package/resources/targets/dsh/js/js/project/scripts/skill-modules/export-config/vite.d.mts +2 -0
  502. package/resources/targets/dsh/js/js/project/scripts/skill-modules/export-config/vite.mjs +34 -0
  503. package/resources/targets/dsh/js/js/project/scripts/write-preview-ready.mjs +22 -0
  504. package/resources/targets/dsh/js/js/project/src/display/ui-stage.ts +156 -0
  505. package/resources/targets/dsh/js/js/project/src/display/viewport.ts +249 -0
  506. package/resources/targets/dsh/js/js/project/src/main.ts +87 -0
  507. package/resources/targets/dsh/js/js/project/src/platform.ts +2 -0
  508. package/resources/targets/dsh/js/js/project/src/scenes/LoadScene.ts +89 -0
  509. package/resources/targets/dsh/js/js/project/src/scenes/PlayScene.ts +17 -0
  510. package/resources/targets/dsh/js/js/project/src/screenUi.ts +185 -0
  511. package/resources/targets/dsh/js/js/project/src/style.css +294 -0
  512. package/resources/targets/dsh/js/js/project/tsconfig.json +20 -0
  513. package/resources/targets/dsh/js/js/project/unified_data_control_config.json +20 -0
  514. package/resources/targets/dsh/js/js/project/vite.config.ts +5 -0
  515. package/resources/targets/dsh/js/recovery.md +17 -0
  516. package/resources/targets/dsh/js/target.json +61 -0
  517. package/resources/targets/dsh/js3d/bootstrap/SKILL.md +20 -0
  518. package/resources/targets/dsh/js3d/context-filter-report.json +27 -0
  519. package/resources/targets/dsh/js3d/craft-game-maker/SKILL.md +72 -0
  520. package/resources/targets/dsh/js3d/craft-game-maker/js3d.md +12 -0
  521. package/resources/targets/dsh/js3d/js3d/bundle.json +108 -0
  522. package/resources/targets/dsh/js3d/js3d/context/AGENTS.md +30 -0
  523. package/resources/targets/dsh/js3d/js3d/context/hooks/hooks.json +14 -0
  524. package/resources/targets/dsh/js3d/js3d/context/knowledge/AssetUrl.md +9 -0
  525. package/resources/targets/dsh/js3d/js3d/context/knowledge/AssetWiring.md +7 -0
  526. package/resources/targets/dsh/js3d/js3d/context/knowledge/CodingGuide/Pitfalls.md +11 -0
  527. package/resources/targets/dsh/js3d/js3d/context/knowledge/Layout.md +7 -0
  528. package/resources/targets/dsh/js3d/js3d/context/knowledge/ResourceLoading.md +11 -0
  529. package/resources/targets/dsh/js3d/js3d/context/knowledge/Runtime.md +9 -0
  530. package/resources/targets/dsh/js3d/js3d/context/skills/asset-usage-audit/SKILL.md +16 -0
  531. package/resources/targets/dsh/js3d/js3d/context/skills/asset-usage-audit/scripts/compare-animations.mjs +48 -0
  532. package/resources/targets/dsh/js3d/js3d/context/skills/asset-usage-audit/scripts/lib/anim.mjs +266 -0
  533. package/resources/targets/dsh/js3d/js3d/context/skills/asset-usage-audit/scripts/lib/glb.mjs +241 -0
  534. package/resources/targets/dsh/js3d/js3d/context/skills/asset-usage-audit/scripts/lib/scan.mjs +455 -0
  535. package/resources/targets/dsh/js3d/js3d/context/skills/asset-usage-audit/scripts/scan-assets.mjs +77 -0
  536. package/resources/targets/dsh/js3d/js3d/context/skills/export-config/SKILL.md +16 -0
  537. package/resources/targets/dsh/js3d/js3d/context/skills/export-config/assets/tooling/cli.mjs +20 -0
  538. package/resources/targets/dsh/js3d/js3d/context/skills/export-config/assets/tooling/config.d.mts +19 -0
  539. package/resources/targets/dsh/js3d/js3d/context/skills/export-config/assets/tooling/config.mjs +1 -0
  540. package/resources/targets/dsh/js3d/js3d/context/skills/export-config/assets/tooling/project.d.mts +6 -0
  541. package/resources/targets/dsh/js3d/js3d/context/skills/export-config/assets/tooling/project.mjs +77 -0
  542. package/resources/targets/dsh/js3d/js3d/context/skills/export-config/assets/tooling/vite.d.mts +2 -0
  543. package/resources/targets/dsh/js3d/js3d/context/skills/export-config/assets/tooling/vite.mjs +34 -0
  544. package/resources/targets/dsh/js3d/js3d/context/skills/export-config/scripts/export-config.mjs +4 -0
  545. package/resources/targets/dsh/js3d/js3d/context/skills/export-config/scripts/install.mjs +89 -0
  546. package/resources/targets/dsh/js3d/js3d/context/skills/export-config/scripts/panel-resource-path.mjs +106 -0
  547. package/resources/targets/dsh/js3d/js3d/context/skills/index.json +31 -0
  548. package/resources/targets/dsh/js3d/js3d/context/skills/performance-audit/SKILL.md +21 -0
  549. package/resources/targets/dsh/js3d/js3d/context/skills/performance-audit/scripts/lib/rules.mjs +470 -0
  550. package/resources/targets/dsh/js3d/js3d/context/skills/performance-audit/scripts/lib/scan.mjs +387 -0
  551. package/resources/targets/dsh/js3d/js3d/context/skills/performance-audit/scripts/lib/source.mjs +398 -0
  552. package/resources/targets/dsh/js3d/js3d/context/skills/performance-audit/scripts/scan-perf.mjs +130 -0
  553. package/resources/targets/dsh/js3d/js3d/context/skills/visual-qa/SKILL.md +14 -0
  554. package/resources/targets/dsh/js3d/js3d/project/README.md +7 -0
  555. package/resources/targets/dsh/js3d/js3d/project/configs/game.controls.json +3 -0
  556. package/resources/targets/dsh/js3d/js3d/project/configs/game.json +3 -0
  557. package/resources/targets/dsh/js3d/js3d/project/game-runtime.json +7 -0
  558. package/resources/targets/dsh/js3d/js3d/project/game.config.json +7 -0
  559. package/resources/targets/dsh/js3d/js3d/project/index.html +12 -0
  560. package/resources/targets/dsh/js3d/js3d/project/package.json +23 -0
  561. package/resources/targets/dsh/js3d/js3d/project/runtime/lightgame/1.1.0/platform/identity/qq-ai-game-sdk.min.js +5 -0
  562. package/resources/targets/dsh/js3d/js3d/project/runtime/lightgame/1.1.0/platform/identity/qq-session.mjs +208 -0
  563. package/resources/targets/dsh/js3d/js3d/project/runtime/lightgame/1.1.0/platform/identity/shared.mjs +37 -0
  564. package/resources/targets/dsh/js3d/js3d/project/runtime/lightgame/1.1.0/platform/platform-capture-video.mjs +227 -0
  565. package/resources/targets/dsh/js3d/js3d/project/runtime/lightgame/1.1.0/platform/platform-service.d.mts +31 -0
  566. package/resources/targets/dsh/js3d/js3d/project/runtime/lightgame/1.1.0/platform/platform-service.mjs +272 -0
  567. package/resources/targets/dsh/js3d/js3d/project/runtime/lightgame/1.1.0/platform/platform.d.mts +79 -0
  568. package/resources/targets/dsh/js3d/js3d/project/runtime/lightgame/1.1.0/platform/platform.mjs +30 -0
  569. package/resources/targets/dsh/js3d/js3d/project/runtime/lightgame/1.1.0/release.json +24 -0
  570. package/resources/targets/dsh/js3d/js3d/project/runtime/lightgame/1.1.0/tooling/cli.mjs +16 -0
  571. package/resources/targets/dsh/js3d/js3d/project/runtime/lightgame/1.1.0/tooling/project.d.mts +4 -0
  572. package/resources/targets/dsh/js3d/js3d/project/runtime/lightgame/1.1.0/tooling/project.mjs +50 -0
  573. package/resources/targets/dsh/js3d/js3d/project/runtime/lightgame/1.1.0/tooling/vite.d.mts +3 -0
  574. package/resources/targets/dsh/js3d/js3d/project/runtime/lightgame/1.1.0/tooling/vite.mjs +72 -0
  575. package/resources/targets/dsh/js3d/js3d/project/runtime/lightgame/1.1.0/tools/assets.d.mts +24 -0
  576. package/resources/targets/dsh/js3d/js3d/project/runtime/lightgame/1.1.0/tools/assets.mjs +2 -0
  577. package/resources/targets/dsh/js3d/js3d/project/runtime/lightgame/1.1.0/tools/astc.d.mts +10 -0
  578. package/resources/targets/dsh/js3d/js3d/project/runtime/lightgame/1.1.0/tools/astc.mjs +1 -0
  579. package/resources/targets/dsh/js3d/js3d/project/runtime/lightgame/1.1.0/tools/glb.d.mts +26 -0
  580. package/resources/targets/dsh/js3d/js3d/project/runtime/lightgame/1.1.0/tools/glb.mjs +351 -0
  581. package/resources/targets/dsh/js3d/js3d/project/scripts/config-export/assert-asset-wiring.mjs +97 -0
  582. package/resources/targets/dsh/js3d/js3d/project/scripts/config-export/panel-resource-path.mjs +106 -0
  583. package/resources/targets/dsh/js3d/js3d/project/scripts/config-export/sync-asset-controls.mjs +327 -0
  584. package/resources/targets/dsh/js3d/js3d/project/scripts/config-export/sync-scene-assets.mjs +191 -0
  585. package/resources/targets/dsh/js3d/js3d/project/scripts/config-export.mjs +15 -0
  586. package/resources/targets/dsh/js3d/js3d/project/scripts/skill-modules/export-config/cli.mjs +20 -0
  587. package/resources/targets/dsh/js3d/js3d/project/scripts/skill-modules/export-config/config.d.mts +19 -0
  588. package/resources/targets/dsh/js3d/js3d/project/scripts/skill-modules/export-config/config.mjs +1 -0
  589. package/resources/targets/dsh/js3d/js3d/project/scripts/skill-modules/export-config/installed.json +6 -0
  590. package/resources/targets/dsh/js3d/js3d/project/scripts/skill-modules/export-config/project.d.mts +6 -0
  591. package/resources/targets/dsh/js3d/js3d/project/scripts/skill-modules/export-config/project.mjs +77 -0
  592. package/resources/targets/dsh/js3d/js3d/project/scripts/skill-modules/export-config/vite.d.mts +2 -0
  593. package/resources/targets/dsh/js3d/js3d/project/scripts/skill-modules/export-config/vite.mjs +34 -0
  594. package/resources/targets/dsh/js3d/js3d/project/scripts/write-preview-ready.mjs +22 -0
  595. package/resources/targets/dsh/js3d/js3d/project/src/display/ui-stage.ts +156 -0
  596. package/resources/targets/dsh/js3d/js3d/project/src/display/viewport.ts +239 -0
  597. package/resources/targets/dsh/js3d/js3d/project/src/main.ts +85 -0
  598. package/resources/targets/dsh/js3d/js3d/project/src/platform.ts +2 -0
  599. package/resources/targets/dsh/js3d/js3d/project/src/style.css +83 -0
  600. package/resources/targets/dsh/js3d/js3d/project/tsconfig.json +20 -0
  601. package/resources/targets/dsh/js3d/js3d/project/unified_data_control_config.json +20 -0
  602. package/resources/targets/dsh/js3d/js3d/project/vite.config.ts +5 -0
  603. package/resources/targets/dsh/js3d/recovery.md +17 -0
  604. package/resources/targets/dsh/js3d/target.json +60 -0
  605. package/resources/targets/index.json +72 -12
  606. package/resources/targets/kimi/js/bootstrap/SKILL.md +20 -0
  607. package/resources/targets/kimi/js/context-filter-report.json +27 -0
  608. package/resources/targets/kimi/js/craft-game-maker/SKILL.md +72 -0
  609. package/resources/targets/kimi/js/craft-game-maker/js.md +10 -0
  610. package/resources/targets/kimi/js/js/bundle.json +97 -0
  611. package/resources/targets/kimi/js/js/context/AGENTS.md +29 -0
  612. package/resources/targets/kimi/js/js/context/hooks/hooks.json +14 -0
  613. package/resources/targets/kimi/js/js/context/knowledge/AssetUrl.md +9 -0
  614. package/resources/targets/kimi/js/js/context/knowledge/AssetWiring.md +7 -0
  615. package/resources/targets/kimi/js/js/context/knowledge/Layout.md +7 -0
  616. package/resources/targets/kimi/js/js/context/knowledge/Lifecycle.md +11 -0
  617. package/resources/targets/kimi/js/js/context/knowledge/ResourceLoading.md +9 -0
  618. package/resources/targets/kimi/js/js/context/skills/export-config/SKILL.md +16 -0
  619. package/resources/targets/kimi/js/js/context/skills/export-config/assets/tooling/cli.mjs +20 -0
  620. package/resources/targets/kimi/js/js/context/skills/export-config/assets/tooling/config.d.mts +19 -0
  621. package/resources/targets/kimi/js/js/context/skills/export-config/assets/tooling/config.mjs +1 -0
  622. package/resources/targets/kimi/js/js/context/skills/export-config/assets/tooling/project.d.mts +6 -0
  623. package/resources/targets/kimi/js/js/context/skills/export-config/assets/tooling/project.mjs +77 -0
  624. package/resources/targets/kimi/js/js/context/skills/export-config/assets/tooling/vite.d.mts +2 -0
  625. package/resources/targets/kimi/js/js/context/skills/export-config/assets/tooling/vite.mjs +34 -0
  626. package/resources/targets/kimi/js/js/context/skills/export-config/scripts/export-config.mjs +4 -0
  627. package/resources/targets/kimi/js/js/context/skills/export-config/scripts/install.mjs +89 -0
  628. package/resources/targets/kimi/js/js/context/skills/export-config/scripts/panel-resource-path.mjs +106 -0
  629. package/resources/targets/kimi/js/js/context/skills/index.json +19 -0
  630. package/resources/targets/kimi/js/js/context/skills/visual-qa/SKILL.md +14 -0
  631. package/resources/targets/kimi/js/js/project/README.md +7 -0
  632. package/resources/targets/kimi/js/js/project/configs/assets.json +1 -0
  633. package/resources/targets/kimi/js/js/project/configs/game.controls.json +3 -0
  634. package/resources/targets/kimi/js/js/project/configs/game.json +3 -0
  635. package/resources/targets/kimi/js/js/project/game-runtime.json +7 -0
  636. package/resources/targets/kimi/js/js/project/game.config.json +7 -0
  637. package/resources/targets/kimi/js/js/project/index.html +20 -0
  638. package/resources/targets/kimi/js/js/project/package.json +22 -0
  639. package/resources/targets/kimi/js/js/project/runtime/lightgame/1.1.0/platform/identity/qq-ai-game-sdk.min.js +5 -0
  640. package/resources/targets/kimi/js/js/project/runtime/lightgame/1.1.0/platform/identity/qq-session.mjs +208 -0
  641. package/resources/targets/kimi/js/js/project/runtime/lightgame/1.1.0/platform/identity/shared.mjs +37 -0
  642. package/resources/targets/kimi/js/js/project/runtime/lightgame/1.1.0/platform/platform-capture-video.mjs +227 -0
  643. package/resources/targets/kimi/js/js/project/runtime/lightgame/1.1.0/platform/platform-service.d.mts +31 -0
  644. package/resources/targets/kimi/js/js/project/runtime/lightgame/1.1.0/platform/platform-service.mjs +272 -0
  645. package/resources/targets/kimi/js/js/project/runtime/lightgame/1.1.0/platform/platform.d.mts +79 -0
  646. package/resources/targets/kimi/js/js/project/runtime/lightgame/1.1.0/platform/platform.mjs +29 -0
  647. package/resources/targets/kimi/js/js/project/runtime/lightgame/1.1.0/release.json +22 -0
  648. package/resources/targets/kimi/js/js/project/runtime/lightgame/1.1.0/tooling/cli.mjs +16 -0
  649. package/resources/targets/kimi/js/js/project/runtime/lightgame/1.1.0/tooling/project.d.mts +4 -0
  650. package/resources/targets/kimi/js/js/project/runtime/lightgame/1.1.0/tooling/project.mjs +50 -0
  651. package/resources/targets/kimi/js/js/project/runtime/lightgame/1.1.0/tooling/vite.d.mts +3 -0
  652. package/resources/targets/kimi/js/js/project/runtime/lightgame/1.1.0/tooling/vite.mjs +72 -0
  653. package/resources/targets/kimi/js/js/project/runtime/lightgame/1.1.0/tools/assets.d.mts +24 -0
  654. package/resources/targets/kimi/js/js/project/runtime/lightgame/1.1.0/tools/assets.mjs +2 -0
  655. package/resources/targets/kimi/js/js/project/runtime/lightgame/1.1.0/tools/astc.d.mts +10 -0
  656. package/resources/targets/kimi/js/js/project/runtime/lightgame/1.1.0/tools/astc.mjs +1 -0
  657. package/resources/targets/kimi/js/js/project/scripts/config-export/assert-asset-wiring.mjs +72 -0
  658. package/resources/targets/kimi/js/js/project/scripts/config-export/panel-resource-path.mjs +106 -0
  659. package/resources/targets/kimi/js/js/project/scripts/config-export/sync-asset-controls.mjs +316 -0
  660. package/resources/targets/kimi/js/js/project/scripts/config-export.mjs +13 -0
  661. package/resources/targets/kimi/js/js/project/scripts/skill-modules/export-config/cli.mjs +20 -0
  662. package/resources/targets/kimi/js/js/project/scripts/skill-modules/export-config/config.d.mts +19 -0
  663. package/resources/targets/kimi/js/js/project/scripts/skill-modules/export-config/config.mjs +1 -0
  664. package/resources/targets/kimi/js/js/project/scripts/skill-modules/export-config/installed.json +6 -0
  665. package/resources/targets/kimi/js/js/project/scripts/skill-modules/export-config/project.d.mts +6 -0
  666. package/resources/targets/kimi/js/js/project/scripts/skill-modules/export-config/project.mjs +77 -0
  667. package/resources/targets/kimi/js/js/project/scripts/skill-modules/export-config/vite.d.mts +2 -0
  668. package/resources/targets/kimi/js/js/project/scripts/skill-modules/export-config/vite.mjs +34 -0
  669. package/resources/targets/kimi/js/js/project/scripts/write-preview-ready.mjs +22 -0
  670. package/resources/targets/kimi/js/js/project/src/display/ui-stage.ts +156 -0
  671. package/resources/targets/kimi/js/js/project/src/display/viewport.ts +249 -0
  672. package/resources/targets/kimi/js/js/project/src/main.ts +87 -0
  673. package/resources/targets/kimi/js/js/project/src/platform.ts +2 -0
  674. package/resources/targets/kimi/js/js/project/src/scenes/LoadScene.ts +89 -0
  675. package/resources/targets/kimi/js/js/project/src/scenes/PlayScene.ts +17 -0
  676. package/resources/targets/kimi/js/js/project/src/screenUi.ts +185 -0
  677. package/resources/targets/kimi/js/js/project/src/style.css +294 -0
  678. package/resources/targets/kimi/js/js/project/tsconfig.json +20 -0
  679. package/resources/targets/kimi/js/js/project/unified_data_control_config.json +20 -0
  680. package/resources/targets/kimi/js/js/project/vite.config.ts +5 -0
  681. package/resources/targets/kimi/js/recovery.md +17 -0
  682. package/resources/targets/kimi/js/target.json +61 -0
  683. package/resources/targets/kimi/js3d/bootstrap/SKILL.md +20 -0
  684. package/resources/targets/kimi/js3d/context-filter-report.json +27 -0
  685. package/resources/targets/kimi/js3d/craft-game-maker/SKILL.md +72 -0
  686. package/resources/targets/kimi/js3d/craft-game-maker/js3d.md +12 -0
  687. package/resources/targets/kimi/js3d/js3d/bundle.json +108 -0
  688. package/resources/targets/kimi/js3d/js3d/context/AGENTS.md +30 -0
  689. package/resources/targets/kimi/js3d/js3d/context/hooks/hooks.json +14 -0
  690. package/resources/targets/kimi/js3d/js3d/context/knowledge/AssetUrl.md +9 -0
  691. package/resources/targets/kimi/js3d/js3d/context/knowledge/AssetWiring.md +7 -0
  692. package/resources/targets/kimi/js3d/js3d/context/knowledge/CodingGuide/Pitfalls.md +11 -0
  693. package/resources/targets/kimi/js3d/js3d/context/knowledge/Layout.md +7 -0
  694. package/resources/targets/kimi/js3d/js3d/context/knowledge/ResourceLoading.md +11 -0
  695. package/resources/targets/kimi/js3d/js3d/context/knowledge/Runtime.md +9 -0
  696. package/resources/targets/kimi/js3d/js3d/context/skills/asset-usage-audit/SKILL.md +16 -0
  697. package/resources/targets/kimi/js3d/js3d/context/skills/asset-usage-audit/scripts/compare-animations.mjs +48 -0
  698. package/resources/targets/kimi/js3d/js3d/context/skills/asset-usage-audit/scripts/lib/anim.mjs +266 -0
  699. package/resources/targets/kimi/js3d/js3d/context/skills/asset-usage-audit/scripts/lib/glb.mjs +241 -0
  700. package/resources/targets/kimi/js3d/js3d/context/skills/asset-usage-audit/scripts/lib/scan.mjs +455 -0
  701. package/resources/targets/kimi/js3d/js3d/context/skills/asset-usage-audit/scripts/scan-assets.mjs +77 -0
  702. package/resources/targets/kimi/js3d/js3d/context/skills/export-config/SKILL.md +16 -0
  703. package/resources/targets/kimi/js3d/js3d/context/skills/export-config/assets/tooling/cli.mjs +20 -0
  704. package/resources/targets/kimi/js3d/js3d/context/skills/export-config/assets/tooling/config.d.mts +19 -0
  705. package/resources/targets/kimi/js3d/js3d/context/skills/export-config/assets/tooling/config.mjs +1 -0
  706. package/resources/targets/kimi/js3d/js3d/context/skills/export-config/assets/tooling/project.d.mts +6 -0
  707. package/resources/targets/kimi/js3d/js3d/context/skills/export-config/assets/tooling/project.mjs +77 -0
  708. package/resources/targets/kimi/js3d/js3d/context/skills/export-config/assets/tooling/vite.d.mts +2 -0
  709. package/resources/targets/kimi/js3d/js3d/context/skills/export-config/assets/tooling/vite.mjs +34 -0
  710. package/resources/targets/kimi/js3d/js3d/context/skills/export-config/scripts/export-config.mjs +4 -0
  711. package/resources/targets/kimi/js3d/js3d/context/skills/export-config/scripts/install.mjs +89 -0
  712. package/resources/targets/kimi/js3d/js3d/context/skills/export-config/scripts/panel-resource-path.mjs +106 -0
  713. package/resources/targets/kimi/js3d/js3d/context/skills/index.json +31 -0
  714. package/resources/targets/kimi/js3d/js3d/context/skills/performance-audit/SKILL.md +21 -0
  715. package/resources/targets/kimi/js3d/js3d/context/skills/performance-audit/scripts/lib/rules.mjs +470 -0
  716. package/resources/targets/kimi/js3d/js3d/context/skills/performance-audit/scripts/lib/scan.mjs +387 -0
  717. package/resources/targets/kimi/js3d/js3d/context/skills/performance-audit/scripts/lib/source.mjs +398 -0
  718. package/resources/targets/kimi/js3d/js3d/context/skills/performance-audit/scripts/scan-perf.mjs +130 -0
  719. package/resources/targets/kimi/js3d/js3d/context/skills/visual-qa/SKILL.md +14 -0
  720. package/resources/targets/kimi/js3d/js3d/project/README.md +7 -0
  721. package/resources/targets/kimi/js3d/js3d/project/configs/game.controls.json +3 -0
  722. package/resources/targets/kimi/js3d/js3d/project/configs/game.json +3 -0
  723. package/resources/targets/kimi/js3d/js3d/project/game-runtime.json +7 -0
  724. package/resources/targets/kimi/js3d/js3d/project/game.config.json +7 -0
  725. package/resources/targets/kimi/js3d/js3d/project/index.html +12 -0
  726. package/resources/targets/kimi/js3d/js3d/project/package.json +23 -0
  727. package/resources/targets/kimi/js3d/js3d/project/runtime/lightgame/1.1.0/platform/identity/qq-ai-game-sdk.min.js +5 -0
  728. package/resources/targets/kimi/js3d/js3d/project/runtime/lightgame/1.1.0/platform/identity/qq-session.mjs +208 -0
  729. package/resources/targets/kimi/js3d/js3d/project/runtime/lightgame/1.1.0/platform/identity/shared.mjs +37 -0
  730. package/resources/targets/kimi/js3d/js3d/project/runtime/lightgame/1.1.0/platform/platform-capture-video.mjs +227 -0
  731. package/resources/targets/kimi/js3d/js3d/project/runtime/lightgame/1.1.0/platform/platform-service.d.mts +31 -0
  732. package/resources/targets/kimi/js3d/js3d/project/runtime/lightgame/1.1.0/platform/platform-service.mjs +272 -0
  733. package/resources/targets/kimi/js3d/js3d/project/runtime/lightgame/1.1.0/platform/platform.d.mts +79 -0
  734. package/resources/targets/kimi/js3d/js3d/project/runtime/lightgame/1.1.0/platform/platform.mjs +30 -0
  735. package/resources/targets/kimi/js3d/js3d/project/runtime/lightgame/1.1.0/release.json +24 -0
  736. package/resources/targets/kimi/js3d/js3d/project/runtime/lightgame/1.1.0/tooling/cli.mjs +16 -0
  737. package/resources/targets/kimi/js3d/js3d/project/runtime/lightgame/1.1.0/tooling/project.d.mts +4 -0
  738. package/resources/targets/kimi/js3d/js3d/project/runtime/lightgame/1.1.0/tooling/project.mjs +50 -0
  739. package/resources/targets/kimi/js3d/js3d/project/runtime/lightgame/1.1.0/tooling/vite.d.mts +3 -0
  740. package/resources/targets/kimi/js3d/js3d/project/runtime/lightgame/1.1.0/tooling/vite.mjs +72 -0
  741. package/resources/targets/kimi/js3d/js3d/project/runtime/lightgame/1.1.0/tools/assets.d.mts +24 -0
  742. package/resources/targets/kimi/js3d/js3d/project/runtime/lightgame/1.1.0/tools/assets.mjs +2 -0
  743. package/resources/targets/kimi/js3d/js3d/project/runtime/lightgame/1.1.0/tools/astc.d.mts +10 -0
  744. package/resources/targets/kimi/js3d/js3d/project/runtime/lightgame/1.1.0/tools/astc.mjs +1 -0
  745. package/resources/targets/kimi/js3d/js3d/project/runtime/lightgame/1.1.0/tools/glb.d.mts +26 -0
  746. package/resources/targets/kimi/js3d/js3d/project/runtime/lightgame/1.1.0/tools/glb.mjs +351 -0
  747. package/resources/targets/kimi/js3d/js3d/project/scripts/config-export/assert-asset-wiring.mjs +97 -0
  748. package/resources/targets/kimi/js3d/js3d/project/scripts/config-export/panel-resource-path.mjs +106 -0
  749. package/resources/targets/kimi/js3d/js3d/project/scripts/config-export/sync-asset-controls.mjs +327 -0
  750. package/resources/targets/kimi/js3d/js3d/project/scripts/config-export/sync-scene-assets.mjs +191 -0
  751. package/resources/targets/kimi/js3d/js3d/project/scripts/config-export.mjs +15 -0
  752. package/resources/targets/kimi/js3d/js3d/project/scripts/skill-modules/export-config/cli.mjs +20 -0
  753. package/resources/targets/kimi/js3d/js3d/project/scripts/skill-modules/export-config/config.d.mts +19 -0
  754. package/resources/targets/kimi/js3d/js3d/project/scripts/skill-modules/export-config/config.mjs +1 -0
  755. package/resources/targets/kimi/js3d/js3d/project/scripts/skill-modules/export-config/installed.json +6 -0
  756. package/resources/targets/kimi/js3d/js3d/project/scripts/skill-modules/export-config/project.d.mts +6 -0
  757. package/resources/targets/kimi/js3d/js3d/project/scripts/skill-modules/export-config/project.mjs +77 -0
  758. package/resources/targets/kimi/js3d/js3d/project/scripts/skill-modules/export-config/vite.d.mts +2 -0
  759. package/resources/targets/kimi/js3d/js3d/project/scripts/skill-modules/export-config/vite.mjs +34 -0
  760. package/resources/targets/kimi/js3d/js3d/project/scripts/write-preview-ready.mjs +22 -0
  761. package/resources/targets/kimi/js3d/js3d/project/src/display/ui-stage.ts +156 -0
  762. package/resources/targets/kimi/js3d/js3d/project/src/display/viewport.ts +239 -0
  763. package/resources/targets/kimi/js3d/js3d/project/src/main.ts +85 -0
  764. package/resources/targets/kimi/js3d/js3d/project/src/platform.ts +2 -0
  765. package/resources/targets/kimi/js3d/js3d/project/src/style.css +83 -0
  766. package/resources/targets/kimi/js3d/js3d/project/tsconfig.json +20 -0
  767. package/resources/targets/kimi/js3d/js3d/project/unified_data_control_config.json +20 -0
  768. package/resources/targets/kimi/js3d/js3d/project/vite.config.ts +5 -0
  769. package/resources/targets/kimi/js3d/recovery.md +17 -0
  770. package/resources/targets/kimi/js3d/target.json +60 -0
  771. package/resources/targets/workbuddy/js/bootstrap/SKILL.md +9 -1
  772. package/resources/targets/workbuddy/js/context-filter-report.json +27 -0
  773. package/resources/targets/workbuddy/js/craft-game-maker/SKILL.md +24 -29
  774. package/resources/targets/workbuddy/js/craft-game-maker/js.md +2 -2
  775. package/resources/targets/workbuddy/js/js/bundle.json +16 -18
  776. package/resources/targets/workbuddy/js/js/context/AGENTS.md +10 -6
  777. package/resources/targets/workbuddy/js/js/context/knowledge/AssetUrl.md +4 -4
  778. package/resources/targets/workbuddy/js/js/context/knowledge/AssetWiring.md +7 -0
  779. package/resources/targets/workbuddy/js/js/context/knowledge/ResourceLoading.md +9 -0
  780. package/resources/targets/workbuddy/js/js/context/skills/export-config/SKILL.md +2 -2
  781. package/resources/targets/workbuddy/js/js/context/skills/index.json +2 -14
  782. package/resources/targets/workbuddy/js/js/context/skills/visual-qa/SKILL.md +1 -1
  783. package/resources/targets/workbuddy/js/recovery.md +16 -4
  784. package/resources/targets/workbuddy/js/target.json +1 -1
  785. package/resources/targets/workbuddy/js3d/bootstrap/SKILL.md +9 -1
  786. package/resources/targets/workbuddy/js3d/context-filter-report.json +27 -0
  787. package/resources/targets/workbuddy/js3d/craft-game-maker/SKILL.md +24 -29
  788. package/resources/targets/workbuddy/js3d/craft-game-maker/js3d.md +3 -4
  789. package/resources/targets/workbuddy/js3d/js3d/bundle.json +19 -21
  790. package/resources/targets/workbuddy/js3d/js3d/context/AGENTS.md +10 -6
  791. package/resources/targets/workbuddy/js3d/js3d/context/knowledge/AssetUrl.md +4 -4
  792. package/resources/targets/workbuddy/js3d/js3d/context/knowledge/AssetWiring.md +7 -0
  793. package/resources/targets/workbuddy/js3d/js3d/context/knowledge/ResourceLoading.md +11 -0
  794. package/resources/targets/workbuddy/js3d/js3d/context/skills/asset-usage-audit/SKILL.md +1 -1
  795. package/resources/targets/workbuddy/js3d/js3d/context/skills/asset-usage-audit/scripts/lib/scan.mjs +2 -2
  796. package/resources/targets/workbuddy/js3d/js3d/context/skills/export-config/SKILL.md +2 -2
  797. package/resources/targets/workbuddy/js3d/js3d/context/skills/index.json +4 -16
  798. package/resources/targets/workbuddy/js3d/js3d/context/skills/performance-audit/SKILL.md +1 -1
  799. package/resources/targets/workbuddy/js3d/js3d/context/skills/visual-qa/SKILL.md +1 -1
  800. package/resources/targets/workbuddy/js3d/recovery.md +16 -4
  801. package/resources/targets/workbuddy/js3d/target.json +1 -1
  802. package/resources/targets/zcode/js/bootstrap/SKILL.md +20 -0
  803. package/resources/targets/zcode/js/context-filter-report.json +27 -0
  804. package/resources/targets/zcode/js/craft-game-maker/SKILL.md +72 -0
  805. package/resources/targets/zcode/js/craft-game-maker/js.md +10 -0
  806. package/resources/targets/zcode/js/js/bundle.json +97 -0
  807. package/resources/targets/zcode/js/js/context/AGENTS.md +29 -0
  808. package/resources/targets/zcode/js/js/context/hooks/hooks.json +14 -0
  809. package/resources/targets/zcode/js/js/context/knowledge/AssetUrl.md +9 -0
  810. package/resources/targets/zcode/js/js/context/knowledge/AssetWiring.md +7 -0
  811. package/resources/targets/zcode/js/js/context/knowledge/Layout.md +7 -0
  812. package/resources/targets/zcode/js/js/context/knowledge/Lifecycle.md +11 -0
  813. package/resources/targets/zcode/js/js/context/knowledge/ResourceLoading.md +9 -0
  814. package/resources/targets/zcode/js/js/context/skills/export-config/SKILL.md +16 -0
  815. package/resources/targets/zcode/js/js/context/skills/export-config/assets/tooling/cli.mjs +20 -0
  816. package/resources/targets/zcode/js/js/context/skills/export-config/assets/tooling/config.d.mts +19 -0
  817. package/resources/targets/zcode/js/js/context/skills/export-config/assets/tooling/config.mjs +1 -0
  818. package/resources/targets/zcode/js/js/context/skills/export-config/assets/tooling/project.d.mts +6 -0
  819. package/resources/targets/zcode/js/js/context/skills/export-config/assets/tooling/project.mjs +77 -0
  820. package/resources/targets/zcode/js/js/context/skills/export-config/assets/tooling/vite.d.mts +2 -0
  821. package/resources/targets/zcode/js/js/context/skills/export-config/assets/tooling/vite.mjs +34 -0
  822. package/resources/targets/zcode/js/js/context/skills/export-config/scripts/export-config.mjs +4 -0
  823. package/resources/targets/zcode/js/js/context/skills/export-config/scripts/install.mjs +89 -0
  824. package/resources/targets/zcode/js/js/context/skills/export-config/scripts/panel-resource-path.mjs +106 -0
  825. package/resources/targets/zcode/js/js/context/skills/index.json +19 -0
  826. package/resources/targets/zcode/js/js/context/skills/visual-qa/SKILL.md +14 -0
  827. package/resources/targets/zcode/js/js/project/README.md +7 -0
  828. package/resources/targets/zcode/js/js/project/configs/assets.json +1 -0
  829. package/resources/targets/zcode/js/js/project/configs/game.controls.json +3 -0
  830. package/resources/targets/zcode/js/js/project/configs/game.json +3 -0
  831. package/resources/targets/zcode/js/js/project/game-runtime.json +7 -0
  832. package/resources/targets/zcode/js/js/project/game.config.json +7 -0
  833. package/resources/targets/zcode/js/js/project/index.html +20 -0
  834. package/resources/targets/zcode/js/js/project/package.json +22 -0
  835. package/resources/targets/zcode/js/js/project/runtime/lightgame/1.1.0/platform/identity/qq-ai-game-sdk.min.js +5 -0
  836. package/resources/targets/zcode/js/js/project/runtime/lightgame/1.1.0/platform/identity/qq-session.mjs +208 -0
  837. package/resources/targets/zcode/js/js/project/runtime/lightgame/1.1.0/platform/identity/shared.mjs +37 -0
  838. package/resources/targets/zcode/js/js/project/runtime/lightgame/1.1.0/platform/platform-capture-video.mjs +227 -0
  839. package/resources/targets/zcode/js/js/project/runtime/lightgame/1.1.0/platform/platform-service.d.mts +31 -0
  840. package/resources/targets/zcode/js/js/project/runtime/lightgame/1.1.0/platform/platform-service.mjs +272 -0
  841. package/resources/targets/zcode/js/js/project/runtime/lightgame/1.1.0/platform/platform.d.mts +79 -0
  842. package/resources/targets/zcode/js/js/project/runtime/lightgame/1.1.0/platform/platform.mjs +29 -0
  843. package/resources/targets/zcode/js/js/project/runtime/lightgame/1.1.0/release.json +22 -0
  844. package/resources/targets/zcode/js/js/project/runtime/lightgame/1.1.0/tooling/cli.mjs +16 -0
  845. package/resources/targets/zcode/js/js/project/runtime/lightgame/1.1.0/tooling/project.d.mts +4 -0
  846. package/resources/targets/zcode/js/js/project/runtime/lightgame/1.1.0/tooling/project.mjs +50 -0
  847. package/resources/targets/zcode/js/js/project/runtime/lightgame/1.1.0/tooling/vite.d.mts +3 -0
  848. package/resources/targets/zcode/js/js/project/runtime/lightgame/1.1.0/tooling/vite.mjs +72 -0
  849. package/resources/targets/zcode/js/js/project/runtime/lightgame/1.1.0/tools/assets.d.mts +24 -0
  850. package/resources/targets/zcode/js/js/project/runtime/lightgame/1.1.0/tools/assets.mjs +2 -0
  851. package/resources/targets/zcode/js/js/project/runtime/lightgame/1.1.0/tools/astc.d.mts +10 -0
  852. package/resources/targets/zcode/js/js/project/runtime/lightgame/1.1.0/tools/astc.mjs +1 -0
  853. package/resources/targets/zcode/js/js/project/scripts/config-export/assert-asset-wiring.mjs +72 -0
  854. package/resources/targets/zcode/js/js/project/scripts/config-export/panel-resource-path.mjs +106 -0
  855. package/resources/targets/zcode/js/js/project/scripts/config-export/sync-asset-controls.mjs +316 -0
  856. package/resources/targets/zcode/js/js/project/scripts/config-export.mjs +13 -0
  857. package/resources/targets/zcode/js/js/project/scripts/skill-modules/export-config/cli.mjs +20 -0
  858. package/resources/targets/zcode/js/js/project/scripts/skill-modules/export-config/config.d.mts +19 -0
  859. package/resources/targets/zcode/js/js/project/scripts/skill-modules/export-config/config.mjs +1 -0
  860. package/resources/targets/zcode/js/js/project/scripts/skill-modules/export-config/installed.json +6 -0
  861. package/resources/targets/zcode/js/js/project/scripts/skill-modules/export-config/project.d.mts +6 -0
  862. package/resources/targets/zcode/js/js/project/scripts/skill-modules/export-config/project.mjs +77 -0
  863. package/resources/targets/zcode/js/js/project/scripts/skill-modules/export-config/vite.d.mts +2 -0
  864. package/resources/targets/zcode/js/js/project/scripts/skill-modules/export-config/vite.mjs +34 -0
  865. package/resources/targets/zcode/js/js/project/scripts/write-preview-ready.mjs +22 -0
  866. package/resources/targets/zcode/js/js/project/src/display/ui-stage.ts +156 -0
  867. package/resources/targets/zcode/js/js/project/src/display/viewport.ts +249 -0
  868. package/resources/targets/zcode/js/js/project/src/main.ts +87 -0
  869. package/resources/targets/zcode/js/js/project/src/platform.ts +2 -0
  870. package/resources/targets/zcode/js/js/project/src/scenes/LoadScene.ts +89 -0
  871. package/resources/targets/zcode/js/js/project/src/scenes/PlayScene.ts +17 -0
  872. package/resources/targets/zcode/js/js/project/src/screenUi.ts +185 -0
  873. package/resources/targets/zcode/js/js/project/src/style.css +294 -0
  874. package/resources/targets/zcode/js/js/project/tsconfig.json +20 -0
  875. package/resources/targets/zcode/js/js/project/unified_data_control_config.json +20 -0
  876. package/resources/targets/zcode/js/js/project/vite.config.ts +5 -0
  877. package/resources/targets/zcode/js/recovery.md +17 -0
  878. package/resources/targets/zcode/js/target.json +61 -0
  879. package/resources/targets/zcode/js3d/bootstrap/SKILL.md +20 -0
  880. package/resources/targets/zcode/js3d/context-filter-report.json +27 -0
  881. package/resources/targets/zcode/js3d/craft-game-maker/SKILL.md +72 -0
  882. package/resources/targets/zcode/js3d/craft-game-maker/js3d.md +12 -0
  883. package/resources/targets/zcode/js3d/js3d/bundle.json +108 -0
  884. package/resources/targets/zcode/js3d/js3d/context/AGENTS.md +30 -0
  885. package/resources/targets/zcode/js3d/js3d/context/hooks/hooks.json +14 -0
  886. package/resources/targets/zcode/js3d/js3d/context/knowledge/AssetUrl.md +9 -0
  887. package/resources/targets/zcode/js3d/js3d/context/knowledge/AssetWiring.md +7 -0
  888. package/resources/targets/zcode/js3d/js3d/context/knowledge/CodingGuide/Pitfalls.md +11 -0
  889. package/resources/targets/zcode/js3d/js3d/context/knowledge/Layout.md +7 -0
  890. package/resources/targets/zcode/js3d/js3d/context/knowledge/ResourceLoading.md +11 -0
  891. package/resources/targets/zcode/js3d/js3d/context/knowledge/Runtime.md +9 -0
  892. package/resources/targets/zcode/js3d/js3d/context/skills/asset-usage-audit/SKILL.md +16 -0
  893. package/resources/targets/zcode/js3d/js3d/context/skills/asset-usage-audit/scripts/compare-animations.mjs +48 -0
  894. package/resources/targets/zcode/js3d/js3d/context/skills/asset-usage-audit/scripts/lib/anim.mjs +266 -0
  895. package/resources/targets/zcode/js3d/js3d/context/skills/asset-usage-audit/scripts/lib/glb.mjs +241 -0
  896. package/resources/targets/zcode/js3d/js3d/context/skills/asset-usage-audit/scripts/lib/scan.mjs +455 -0
  897. package/resources/targets/zcode/js3d/js3d/context/skills/asset-usage-audit/scripts/scan-assets.mjs +77 -0
  898. package/resources/targets/zcode/js3d/js3d/context/skills/export-config/SKILL.md +16 -0
  899. package/resources/targets/zcode/js3d/js3d/context/skills/export-config/assets/tooling/cli.mjs +20 -0
  900. package/resources/targets/zcode/js3d/js3d/context/skills/export-config/assets/tooling/config.d.mts +19 -0
  901. package/resources/targets/zcode/js3d/js3d/context/skills/export-config/assets/tooling/config.mjs +1 -0
  902. package/resources/targets/zcode/js3d/js3d/context/skills/export-config/assets/tooling/project.d.mts +6 -0
  903. package/resources/targets/zcode/js3d/js3d/context/skills/export-config/assets/tooling/project.mjs +77 -0
  904. package/resources/targets/zcode/js3d/js3d/context/skills/export-config/assets/tooling/vite.d.mts +2 -0
  905. package/resources/targets/zcode/js3d/js3d/context/skills/export-config/assets/tooling/vite.mjs +34 -0
  906. package/resources/targets/zcode/js3d/js3d/context/skills/export-config/scripts/export-config.mjs +4 -0
  907. package/resources/targets/zcode/js3d/js3d/context/skills/export-config/scripts/install.mjs +89 -0
  908. package/resources/targets/zcode/js3d/js3d/context/skills/export-config/scripts/panel-resource-path.mjs +106 -0
  909. package/resources/targets/zcode/js3d/js3d/context/skills/index.json +31 -0
  910. package/resources/targets/zcode/js3d/js3d/context/skills/performance-audit/SKILL.md +21 -0
  911. package/resources/targets/zcode/js3d/js3d/context/skills/performance-audit/scripts/lib/rules.mjs +470 -0
  912. package/resources/targets/zcode/js3d/js3d/context/skills/performance-audit/scripts/lib/scan.mjs +387 -0
  913. package/resources/targets/zcode/js3d/js3d/context/skills/performance-audit/scripts/lib/source.mjs +398 -0
  914. package/resources/targets/zcode/js3d/js3d/context/skills/performance-audit/scripts/scan-perf.mjs +130 -0
  915. package/resources/targets/zcode/js3d/js3d/context/skills/visual-qa/SKILL.md +14 -0
  916. package/resources/targets/zcode/js3d/js3d/project/README.md +7 -0
  917. package/resources/targets/zcode/js3d/js3d/project/configs/game.controls.json +3 -0
  918. package/resources/targets/zcode/js3d/js3d/project/configs/game.json +3 -0
  919. package/resources/targets/zcode/js3d/js3d/project/game-runtime.json +7 -0
  920. package/resources/targets/zcode/js3d/js3d/project/game.config.json +7 -0
  921. package/resources/targets/zcode/js3d/js3d/project/index.html +12 -0
  922. package/resources/targets/zcode/js3d/js3d/project/package.json +23 -0
  923. package/resources/targets/zcode/js3d/js3d/project/runtime/lightgame/1.1.0/platform/identity/qq-ai-game-sdk.min.js +5 -0
  924. package/resources/targets/zcode/js3d/js3d/project/runtime/lightgame/1.1.0/platform/identity/qq-session.mjs +208 -0
  925. package/resources/targets/zcode/js3d/js3d/project/runtime/lightgame/1.1.0/platform/identity/shared.mjs +37 -0
  926. package/resources/targets/zcode/js3d/js3d/project/runtime/lightgame/1.1.0/platform/platform-capture-video.mjs +227 -0
  927. package/resources/targets/zcode/js3d/js3d/project/runtime/lightgame/1.1.0/platform/platform-service.d.mts +31 -0
  928. package/resources/targets/zcode/js3d/js3d/project/runtime/lightgame/1.1.0/platform/platform-service.mjs +272 -0
  929. package/resources/targets/zcode/js3d/js3d/project/runtime/lightgame/1.1.0/platform/platform.d.mts +79 -0
  930. package/resources/targets/zcode/js3d/js3d/project/runtime/lightgame/1.1.0/platform/platform.mjs +30 -0
  931. package/resources/targets/zcode/js3d/js3d/project/runtime/lightgame/1.1.0/release.json +24 -0
  932. package/resources/targets/zcode/js3d/js3d/project/runtime/lightgame/1.1.0/tooling/cli.mjs +16 -0
  933. package/resources/targets/zcode/js3d/js3d/project/runtime/lightgame/1.1.0/tooling/project.d.mts +4 -0
  934. package/resources/targets/zcode/js3d/js3d/project/runtime/lightgame/1.1.0/tooling/project.mjs +50 -0
  935. package/resources/targets/zcode/js3d/js3d/project/runtime/lightgame/1.1.0/tooling/vite.d.mts +3 -0
  936. package/resources/targets/zcode/js3d/js3d/project/runtime/lightgame/1.1.0/tooling/vite.mjs +72 -0
  937. package/resources/targets/zcode/js3d/js3d/project/runtime/lightgame/1.1.0/tools/assets.d.mts +24 -0
  938. package/resources/targets/zcode/js3d/js3d/project/runtime/lightgame/1.1.0/tools/assets.mjs +2 -0
  939. package/resources/targets/zcode/js3d/js3d/project/runtime/lightgame/1.1.0/tools/astc.d.mts +10 -0
  940. package/resources/targets/zcode/js3d/js3d/project/runtime/lightgame/1.1.0/tools/astc.mjs +1 -0
  941. package/resources/targets/zcode/js3d/js3d/project/runtime/lightgame/1.1.0/tools/glb.d.mts +26 -0
  942. package/resources/targets/zcode/js3d/js3d/project/runtime/lightgame/1.1.0/tools/glb.mjs +351 -0
  943. package/resources/targets/zcode/js3d/js3d/project/scripts/config-export/assert-asset-wiring.mjs +97 -0
  944. package/resources/targets/zcode/js3d/js3d/project/scripts/config-export/panel-resource-path.mjs +106 -0
  945. package/resources/targets/zcode/js3d/js3d/project/scripts/config-export/sync-asset-controls.mjs +327 -0
  946. package/resources/targets/zcode/js3d/js3d/project/scripts/config-export/sync-scene-assets.mjs +191 -0
  947. package/resources/targets/zcode/js3d/js3d/project/scripts/config-export.mjs +15 -0
  948. package/resources/targets/zcode/js3d/js3d/project/scripts/skill-modules/export-config/cli.mjs +20 -0
  949. package/resources/targets/zcode/js3d/js3d/project/scripts/skill-modules/export-config/config.d.mts +19 -0
  950. package/resources/targets/zcode/js3d/js3d/project/scripts/skill-modules/export-config/config.mjs +1 -0
  951. package/resources/targets/zcode/js3d/js3d/project/scripts/skill-modules/export-config/installed.json +6 -0
  952. package/resources/targets/zcode/js3d/js3d/project/scripts/skill-modules/export-config/project.d.mts +6 -0
  953. package/resources/targets/zcode/js3d/js3d/project/scripts/skill-modules/export-config/project.mjs +77 -0
  954. package/resources/targets/zcode/js3d/js3d/project/scripts/skill-modules/export-config/vite.d.mts +2 -0
  955. package/resources/targets/zcode/js3d/js3d/project/scripts/skill-modules/export-config/vite.mjs +34 -0
  956. package/resources/targets/zcode/js3d/js3d/project/scripts/write-preview-ready.mjs +22 -0
  957. package/resources/targets/zcode/js3d/js3d/project/src/display/ui-stage.ts +156 -0
  958. package/resources/targets/zcode/js3d/js3d/project/src/display/viewport.ts +239 -0
  959. package/resources/targets/zcode/js3d/js3d/project/src/main.ts +85 -0
  960. package/resources/targets/zcode/js3d/js3d/project/src/platform.ts +2 -0
  961. package/resources/targets/zcode/js3d/js3d/project/src/style.css +83 -0
  962. package/resources/targets/zcode/js3d/js3d/project/tsconfig.json +20 -0
  963. package/resources/targets/zcode/js3d/js3d/project/unified_data_control_config.json +20 -0
  964. package/resources/targets/zcode/js3d/js3d/project/vite.config.ts +5 -0
  965. package/resources/targets/zcode/js3d/recovery.md +17 -0
  966. package/resources/targets/zcode/js3d/target.json +60 -0
  967. package/vendor/craft-runtime/SOURCE.json +3 -3
  968. package/vendor/craft-runtime/package.json +1 -1
  969. package/dist-server/game-workflow/publication-materials.mjs +0 -92
  970. package/dist-server/game-workflow/publications.mjs +0 -164
  971. package/dist-server/game-workflow/publish-capture-worker.mjs +0 -57
  972. package/dist-server/game-workflow/publish-capture.mjs +0 -75
  973. package/dist-server/mcp/publication-page.html +0 -86
  974. package/dist-server/mcp/publication-page.mjs +0 -375
  975. package/dist-server/mcp/publication-preview.mjs +0 -63
  976. package/dist-server/mcp/publication-tools.mjs +0 -22
  977. package/dist-server/mcp/publish-panel.mjs +0 -205
  978. package/dist-server/upstream/publication-transport.mjs +0 -101
  979. package/resources/targets/codebuddy/js/js/context/knowledge/AigcWiring.md +0 -9
  980. package/resources/targets/codebuddy/js/js/context/skills/aigc-generate/SKILL.md +0 -14
  981. package/resources/targets/codebuddy/js/js/context/skills/asset-search/SKILL.md +0 -12
  982. package/resources/targets/codebuddy/js/js/context/skills/asset-search/references/resource-config.md +0 -9
  983. package/resources/targets/codebuddy/js3d/js3d/context/knowledge/AigcWiring.md +0 -9
  984. package/resources/targets/codebuddy/js3d/js3d/context/skills/aigc-integration/SKILL.md +0 -14
  985. package/resources/targets/codebuddy/js3d/js3d/context/skills/asset-search/SKILL.md +0 -12
  986. package/resources/targets/codex/js/js/context/knowledge/AigcWiring.md +0 -9
  987. package/resources/targets/codex/js/js/context/skills/aigc-generate/SKILL.md +0 -14
  988. package/resources/targets/codex/js/js/context/skills/asset-search/SKILL.md +0 -12
  989. package/resources/targets/codex/js/js/context/skills/asset-search/references/resource-config.md +0 -9
  990. package/resources/targets/codex/js3d/js3d/context/knowledge/AigcWiring.md +0 -9
  991. package/resources/targets/codex/js3d/js3d/context/skills/aigc-integration/SKILL.md +0 -14
  992. package/resources/targets/codex/js3d/js3d/context/skills/asset-search/SKILL.md +0 -12
  993. package/resources/targets/workbuddy/js/js/context/knowledge/AigcWiring.md +0 -9
  994. package/resources/targets/workbuddy/js/js/context/skills/aigc-generate/SKILL.md +0 -14
  995. package/resources/targets/workbuddy/js/js/context/skills/asset-search/SKILL.md +0 -12
  996. package/resources/targets/workbuddy/js/js/context/skills/asset-search/references/resource-config.md +0 -9
  997. package/resources/targets/workbuddy/js3d/js3d/context/knowledge/AigcWiring.md +0 -9
  998. package/resources/targets/workbuddy/js3d/js3d/context/skills/aigc-integration/SKILL.md +0 -14
  999. package/resources/targets/workbuddy/js3d/js3d/context/skills/asset-search/SKILL.md +0 -12
@@ -3,57 +3,45 @@ import { randomBytes } from 'node:crypto';
3
3
  import { readFile } from 'node:fs/promises';
4
4
  import { sendJson, parseJsonBody } from '../core/http-utils.mjs';
5
5
 
6
- export async function openControlPanel(platform,{ allowLocalAuth=true,publishPanel,publicationDirectory=new URL('./',import.meta.url) }={}) {
6
+ export async function openControlPanel(platform,{ allowLocalAuth=true }={}) {
7
7
  const csrf=randomBytes(32).toString('hex');
8
8
  const template=await readFile(new URL('./control-panel.html',import.meta.url),'utf8');
9
- let port,origin;
10
- const secure=(res,frameOrigin)=>{
11
- res.setHeader('Content-Security-Policy',`default-src 'none'; script-src 'nonce-${csrf}'; style-src 'unsafe-inline'; connect-src 'self'; img-src 'self' data: blob:; frame-src ${frameOrigin || "'none'"}; frame-ancestors 'none'; base-uri 'none'; form-action 'self'`);
9
+ let port,origin,activeRequests=0;
10
+ const secure=res=>{
11
+ res.setHeader('Content-Security-Policy',`default-src 'none'; script-src 'nonce-${csrf}'; style-src 'unsafe-inline'; connect-src 'self'; img-src 'self' data: blob:; frame-src 'none'; frame-ancestors 'none'; base-uri 'none'; form-action 'self'`);
12
12
  };
13
13
  const server=http.createServer(async(req,res)=>{
14
+ activeRequests++;
15
+ try {
14
16
  res.setHeader('Cache-Control','no-store');res.setHeader('X-Content-Type-Options','nosniff');res.setHeader('Referrer-Policy','no-referrer');
15
17
  if(req.headers.host!==`127.0.0.1:${port}` || (req.headers.origin && req.headers.origin!==origin) || req.headers['sec-fetch-site']==='cross-site') {
16
18
  req.resume();sendJson(res,403,{error:'Only same-origin requests are accepted'});return;
17
19
  }
18
20
  try {
19
21
  const url=new URL(req.url,origin);
20
- const page=/^\/publish\/([A-Za-z0-9_-]{43})$/.exec(url.pathname);
21
- if(publishPanel && req.method==='GET' && page) {
22
- const data=await publishPanel.document(page[1]);
23
- const html=await readFile(new URL('publication-page.html',publicationDirectory),'utf8');
24
- secure(res,data.runtime_url ? new URL(data.runtime_url).origin : undefined);
25
- res.writeHead(200,{'Content-Type':'text/html; charset=utf-8'});
26
- res.end(html.replaceAll('__CSRF__',csrf).replaceAll('__PUBLISH_CAP__',page[1]));return;
27
- }
28
- if(publishPanel && req.method==='GET' && url.pathname==='/publication-page.mjs') {
29
- const script=await readFile(new URL('publication-page.mjs',publicationDirectory));
30
- res.writeHead(200,{'Content-Type':'text/javascript; charset=utf-8'});res.end(script);return;
31
- }
32
22
  if(req.method==='GET' && url.pathname==='/') {
33
23
  if(!allowLocalAuth) {sendJson(res,404,{error:'Update credentials in the host AI IDE Craft MCP settings and reconnect'});return;}
34
24
  secure(res);res.writeHead(200,{'Content-Type':'text/html; charset=utf-8'});res.end(template.replaceAll('__CSRF__',csrf));return;
35
25
  }
36
26
  if(req.method==='GET' && url.pathname==='/data') {sendJson(res,200,await platform.status());return;}
37
- const api=/^\/api\/publish\/([A-Za-z0-9_-]{43})\/(state|cover|prepare|review|submit|status|task)$/.exec(url.pathname);
38
27
  const auth=allowLocalAuth && ['/login','/logout'].includes(url.pathname);
39
28
  if(req.method==='POST') {
40
- if((!api || !publishPanel) && !auth) {req.resume();sendJson(res,404,{error:'Not found'});return;}
29
+ if(!auth) {req.resume();sendJson(res,404,{error:'Not found'});return;}
41
30
  if(req.headers.origin!==origin || req.headers['x-craft-csrf']!==csrf || req.headers['content-type']!=='application/json') {
42
31
  req.resume();sendJson(res,403,{error:'Invalid local control request'});return;
43
32
  }
44
- const body=await parseJsonBody(req,api?.[2] === 'cover' ? 3*1024*1024 : api ? 64*1024 : 8192);
45
- const result=api ? await publishPanel.handle(api[1],api[2],req.method,url.searchParams,body) :
46
- url.pathname==='/login' ? await platform.login(body.token) : platform.logout();
33
+ const body=await parseJsonBody(req,8192);
34
+ const result=url.pathname==='/login' ? await platform.login(body.token) : platform.logout();
47
35
  sendJson(res,200,result);return;
48
36
  }
49
- if(publishPanel && api) {sendJson(res,200,await publishPanel.handle(api[1],api[2],req.method,url.searchParams));return;}
50
37
  req.resume();sendJson(res,404,{error:'Not found'});
51
38
  } catch(error) {
52
39
  sendJson(res,Number.isInteger(error.status) && error.status>=400 && error.status<600 ? error.status : 400,
53
40
  {error:error.message,platform:platform.base,...error.detail});
54
41
  }
42
+ } finally { activeRequests--; }
55
43
  });
56
44
  await new Promise((resolve,reject)=>{server.once('error',reject);server.listen(0,'127.0.0.1',resolve);});
57
- port=server.address().port;origin=`http://127.0.0.1:${port}`;publishPanel?.bindOrigin(origin);
58
- return {url:origin,close:async()=>{await publishPanel?.close();server.closeAllConnections();await new Promise(resolve=>server.close(resolve));}};
45
+ port=server.address().port;origin=`http://127.0.0.1:${port}`;
46
+ return {url:origin,get activeRequests(){return activeRequests;},close:async()=>{server.closeAllConnections();await new Promise(resolve=>server.close(resolve));}};
59
47
  }
@@ -1,4 +1,6 @@
1
1
  import path from 'node:path';
2
+ import { randomUUID } from 'node:crypto';
3
+ import { fileURLToPath } from 'node:url';
2
4
  import { mkdir, realpath, readFile } from 'node:fs/promises';
3
5
  import { Server } from '@modelcontextprotocol/sdk/server/index.js';
4
6
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
@@ -16,22 +18,23 @@ import { libraryCapabilities } from '../game-workflow/library-catalog.mjs';
16
18
  import { checkGame, validateSteps } from '../game-workflow/check.mjs';
17
19
  import { DraftUploads, draftUploadView } from '../game-workflow/draft-uploads.mjs';
18
20
  import { DraftBindings } from '../game-workflow/draft-bindings.mjs';
19
- import { Publications } from '../game-workflow/publications.mjs';
20
21
  import { Previews } from '../preview/local-static-preview.mjs';
21
22
  import { openControlPanel } from './control-panel.mjs';
22
- import { createPublishPanel } from './publish-panel.mjs';
23
- import { openPublicationPreview } from './publication-preview.mjs';
24
23
  import { loadEngineResources, loadEngineResource } from '../game-workflow/engines.mjs';
25
24
  import { assetCapabilities } from '../game-workflow/resource-catalog.mjs';
26
25
  import { takeConnectorToken, ConnectorAuthStore, connectorLoginAction } from '../core/connector-auth.mjs';
27
26
  import { generationFields, importFields, generationInputs, searchFields, importSource } from './asset-tools.mjs';
28
- import { publicationTools } from './publication-tools.mjs';
29
27
  import { clientIde } from '../integrations/hosts.mjs';
28
+ import { currentWork, withWork, guardWork } from '../game-workflow/work-scope.mjs';
29
+ import { getRuntimeIdentity } from '../integrations/runtime.mjs';
30
+ import { UpdateSession } from './update-session.mjs';
31
+ import { registerRuntimeConnection } from '../integrations/runtime-gc.mjs';
30
32
 
31
33
  // Consume before any project/build subprocess can inherit the credential.
32
34
  let connectorToken = takeConnectorToken();
33
35
  const connectorAuth = connectorToken !== undefined;
34
36
  const { version } = JSON.parse(await readFile(new URL('../../package.json',import.meta.url),'utf8'));
37
+ const runtimeIdentity={...await getRuntimeIdentity(fileURLToPath(new URL('../..',import.meta.url))),instance_id:randomUUID(),pid:process.pid,activation_mode:'next_mcp_start'};
35
38
  await mkdir(getWorkspaceRoot(),{ recursive:true });
36
39
  const root = await realpath(getWorkspaceRoot()), state = getUserDataDir(), resources = process.env.CRAFT_MCP_RESOURCES_DIR;
37
40
  const store = new RequestStore(path.join(state,'requests'),root); await store.init();
@@ -54,22 +57,30 @@ const reviewed = new Set();
54
57
  const uploadStore = new RequestStore(path.join(state,'uploads'),root); await uploadStore.init();
55
58
  const resourcePaths = { capture:path.join(resources,'game_visual_qa.mjs'), evidence:path.join(path.dirname(uploadStore.directory),'checks') };
56
59
  const drafts = new DraftUploads(platform,uploadStore,resourcePaths.evidence,new DraftBindings(getProjectBindingsDir(),root));
57
- const publicationStore = new RequestStore(path.join(state,'publications'),root); await publicationStore.init();
58
- const publications = new Publications(platform,publicationStore,drafts,resourcePaths.evidence);
59
60
  const mutations = new Set();
60
61
  let closing = false;
61
- async function mutateProject(name,operation) {
62
- projects.file(name);
63
- if (closing || mutations.has(name) || tasks.busy(name)) throw new Error('Project has a running operation');
64
- mutations.add(name);
65
- try { await leases.acquire(name); return await operation(); }
66
- finally { mutations.delete(name); }
62
+ let authInteraction=false;
63
+ async function validateWork(work,{preparing=false}={}) {
64
+ await leases.assert(work.name,work.work_id,{ready:!preparing,context_revision:work.context_revision});
65
+ if(!preparing) await projects.assertRevision(work.name,work.context_revision);
66
+ }
67
+ const panel=await openControlPanel(platform,{ allowLocalAuth:!connectorAuth });
68
+ function runtimeBusy({excludeUpdate=false}={}) {
69
+ if(platform.store.getSession().loggedIn) authInteraction=false;
70
+ const busy={work_count:leases.activeCount,task_count:tasks.activeCount,mutation_count:mutations.size,
71
+ interaction_count:panel.activeRequests+Number(authInteraction),
72
+ update_count:Math.max(0,updates.activeOperations-Number(excludeUpdate))};
73
+ return {...busy,can_reconnect:!closing && Object.values(busy).every(count=>count===0)};
74
+ }
75
+ const updates=new UpdateSession({installationFile:process.env.CRAFT_INSTALLATION_FILE,current:runtimeIdentity,projects,host,workspace:root,platform:platform.base,busy:runtimeBusy});
76
+ let runtimeConnection;
77
+ if(process.env.CRAFT_INSTALLATION_FILE && !await updates.scopeError()) {
78
+ try { runtimeConnection=await registerRuntimeConnection({installationFile:process.env.CRAFT_INSTALLATION_FILE,current:runtimeIdentity}); }
79
+ catch { process.stderr.write('[craft] Runtime cleanup is unavailable for this connection; MCP remains active.\n'); }
67
80
  }
68
- const publishPanel=createPublishPanel({ platform,projects,tasks,drafts,publications,checkedTask,mutate:mutateProject,viewTask,
69
- coverDirectory:path.join(state,'publication-covers'),preview:async check=>openPublicationPreview(check,resourcePaths.evidence,undefined,{ assetOrigins:await assets.approvedResourceOrigins(check.name),platformOrigin:platform.base }) });
70
- const panel=await openControlPanel(platform,{ allowLocalAuth:!connectorAuth,publishPanel });
71
81
  function loginAction() {
72
82
  if (connectorAuth) return connectorLoginAction();
83
+ authInteraction=true;
73
84
  const url = panel.url;
74
85
  return { status:'action_required',reason:'login',human_action_required:true,url,
75
86
  user_message:`请点击[连接 Craft 账号](${url}),在本机页面输入 Token 后,回到这里说“继续”。Token 无需发送到聊天中。` };
@@ -77,11 +88,18 @@ function loginAction() {
77
88
  const nameField = { name:{ type:'string', pattern:'^[a-z][a-z0-9-]{0,47}$', description:'Stable local project name. Reuse it for follow-up edits.' } };
78
89
  const engineField = { engine:{ type:'string',enum:['js','js3d'],description:'Choose js for 2D/Phaser, js3d for 3D/Three.js. New games default to js; existing games keep their saved engine. Never change an existing game engine.' } };
79
90
  const taskField = { task_id:{ type:'string' } };
80
- const draftFields = { ...nameField, check_task_id:{ type:'string', description:'ID of the passing check for this exact draft build. Reuse the same ID to recover an upload.' } };
81
- const tool = (name,description,properties={},required=[])=>({ name,description,inputSchema:{ type:'object',properties,required,additionalProperties:false } });
91
+ const workField = {work_id:{type:'string',description:'Exact work_id from the completed prepare. Keep it for this editing work; release when finished.'}};
92
+ const workTools=new Set(['craft_assets_generate','craft_assets_search','craft_assets_import','craft_game_check','craft_game_review','craft_game_deliver','craft_game_upload','craft_preview_stop','craft_task_cancel']);
93
+ const draftFields = { ...nameField, check_task_id:{ type:'string', description:'ID of the passing check for this exact draft build. Reuse the same ID to recover an upload.' },
94
+ upload_mode:{type:'string',enum:['current_project','new_project'],description:'Defaults to current_project: append a version using local source/dist and make it current, without merging Web edits. Use new_project only when the user explicitly asks for a new cloud project; success switches the local binding.'},
95
+ request_key:{type:'string',pattern:'^[A-Za-z0-9_-]{1,80}$',description:'Required for new_project. Create a new key for an explicitly new upload operation; reuse the exact key, mode and check_task_id on retry or status queries.'} };
96
+ const tool = (name,description,properties={},required=[])=>({ name,description,inputSchema:{ type:'object',properties:{...properties,...(workTools.has(name)?workField:{})},required:[...required,...(workTools.has(name)?['work_id']:[])],additionalProperties:false },...(['craft_game_info','craft_update_check'].includes(name)?{annotations:{readOnlyHint:true,destructiveHint:false,idempotentHint:true}}:name==='craft_update'?{annotations:{readOnlyHint:false,destructiveHint:false}}:{}) });
82
97
  const tools = [
83
- tool('craft_game_info','Show Craft version, supported engines and game-making instructions. Supply name to read an existing game engine and context, or engine to inspect the matching 2D/3D guide. Asset-source choices follow that engine AGENTS.md, relevant skills and user requirements.',{...nameField,...engineField}),
84
- tool('craft_game_prepare','Create or attach a Craft game and bind the current host context. Existing code and other host bindings are preserved. Poll to completion and read returned context. Use upgrade_context or context_bundle_id only for an explicitly requested context migration/update/rollback; ordinary recovery keeps its pinned version.',{...nameField,...engineField,upgrade_context:{type:'boolean',description:'Explicitly adopt the installed context for this host, including migration of a legacy lock'},context_bundle_id:{type:'string',pattern:'^[a-f0-9]{64}$',description:'Explicitly select an already retained context bundle for this host; mutually exclusive with upgrade_context'}},['name']),
98
+ tool('craft_update_check','Read-only check of the configured npm channel, actual running version, installed target and optional existing project compatibility. Never installs, writes receipts or updates project files. At the first Craft task in a session, check with its request_key. If update_available and automatic_update_enabled, call craft_update with the same key. A newer installed target takes effect at the next MCP start or user reconnect.',{...nameField,request_key:{type:'string'}}),
99
+ tool('craft_update','Download, verify and install a compatible newer release, preserving the running process and current work. mode=auto (default) respects the configured policy; manual is only for an explicit user update request. Pass an existing project name for compatibility checking and reuse the check request_key. pending_reconnect means installed, not running: wait for next MCP start or user reconnect, then verify actual version/build_id/active_verified and host scope with craft_game_info before new preparation. Do not reload automatically or replay paid operations. prepare(resume) then refreshes the project context and Skills.',{...nameField,request_key:{type:'string'},mode:{type:'string',enum:['auto','manual']}},['request_key']),
100
+ tool('craft_game_info','Read-only inspection of installed or project context, versions, integrity, preparation, occupancy and preview. Never updates or registers a project and never acquires editing ownership. full_integrity=true checks managed files without repairing. To edit, call prepare mode=create/resume; to inspect only, read existing files without prepare.',{...nameField,...engineField,full_integrity:{type:'boolean'}}),
101
+ tool('craft_game_prepare','Begin an editing work. create requires a new directory and installs dependencies; resume requires an existing Craft game, synchronizes compatible installed context and recovery entries without reseeding, installing dependencies or building. Reuse request_key for retries; pass work_id to inspect the same active work without upgrading it. Poll prepare completion, retain work_id/context_revision, and reread returned local context before editing. Release when finished.',{...nameField,...engineField,...workField,mode:{type:'string',enum:['create','resume']},request_key:{type:'string'}},['name','mode','request_key']),
102
+ tool('craft_game_release','Finish this editing work after all background tasks complete or are cancelled and cleaned up. Releases ownership without disconnecting MCP or stopping a preview. Does not accept or publish a game. Idempotent for the exact ended work_id.',{...nameField,...workField},['name','work_id']),
85
103
  tool('craft_assets_generate','Generate and import 1 to 8 assets when selected by the current engine context and user requirements: image/image_edit, static_mesh, skeletal_mesh, music, video, sprite_sheet or animation (video_url + model_resource_id). Use assets[].kind; inspect craft_game_info.aigc for capabilities. Platform charges automatically. Reuse request_key after failures or restart; never repeat an uncertain paid submission with a new key. Poll craft_task_status and wire the returned config_file slots into the game.',{...nameField,...generationFields},['name']),
86
104
  tool('craft_assets_search','Search the Craft asset library without generating assets. Read craft_game_info.library for categories matching the saved engine. Submit 1 to 8 slot/category/query entries; inspect candidates, scores, metadata and per-slot errors. Poll craft_task_status, then import chosen source=library with search_id/candidate_id. No arbitrary URLs or external search credentials.',{...nameField,...searchFields},['name','queries']),
87
105
  tool('craft_assets_import','Import existing AIGC outputs by resource_id, or selected library candidates with source=library, search_id and candidate_id. One source per batch. Never generates assets. Preserves the original AIGC URL or library Path and updates engine configs/controls without downloading payloads. Poll craft_task_status.',{...nameField,...importFields},['name','assets']),
@@ -99,11 +117,8 @@ const tools = [
99
117
  tool('craft_game_deliver','Prepare a verified preview after a current passing check and visual review. Craft does not launch the process. Run result.start.script with the external host terminal tool in the background, then poll craft_game_info(name).preview until running=true and snapshot matches this delivery. Verify the page before reporting its URL. The host or OS may reclaim it; restart using the returned command.',{
100
118
  ...taskField,visual_passed:{ type:'boolean' },visual_notes:{ type:'string',minLength:10,maxLength:2000 },
101
119
  },['task_id','visual_passed','visual_notes']),
102
- tool('craft_game_upload','When the user asks to upload, transfer the frozen build from a current passing check to a private Craft draft. The same local project, account and platform automatically reuse the saved app ID and append a version. Poll craft_task_status. Reuse the same check_task_id after interruption. draft_ready means the private upload is complete, not published. Use craft_game_deliver and the IDE terminal for local preview.',draftFields,['name','check_task_id']),
103
- tool('craft_game_publish_status','Query publication review with publication_id, or private upload status with check_task_id. Supply exactly one ID. Only report public publication after this specific version reaches share_completed and returns its verified public_url.',{
104
- ...draftFields,publication_id:{ type:'string' },
105
- },['name']),
106
- ...publicationTools(nameField,tool),
120
+ tool('craft_game_upload','Before uploading, tell the user that local source/dist will become the current cloud version and Web edits not synced locally are not included; history remains available for rollback. Default: append to the bound project (create on first upload). Only explicit user requests select new_project. Poll craft_task_status; retry with the same check_task_id, upload_mode and request_key. On success report version_number (vN), appid and project_url; publication remains in Craft Web.',draftFields,['name','check_task_id']),
121
+ tool('craft_game_upload_status','Read the private upload receipt for this check, including the Craft Web project link when complete.',draftFields,['name','check_task_id']),
107
122
  tool('craft_preview_stop','Stop this project host-launched preview and cancel pending starts, including an earlier session preview.',nameField,['name']),
108
123
  tool('craft_auth_open','Check login first. Return a login URL only when unauthenticated; an authenticated account continues without a login URL. Image generation uses automatic platform billing. Never read credentials or automate login.'),
109
124
  tool('craft_auth_status','Check the Craft account without exposing credentials.'),
@@ -111,23 +126,36 @@ const tools = [
111
126
  ];
112
127
  // The connection and prepare result use the same maintained workflow; clients may omit initialize instructions from their model context.
113
128
  const server = new Server({ name:'craft-local',version },{ capabilities:{ tools:{} },instructions:guide });
129
+ let connectionReady=Promise.resolve();
130
+ server.oninitialized=()=>{
131
+ if(closing) return;
132
+ connectionReady=(async()=>{
133
+ const confirmation=await updates.connected();
134
+ if(confirmation.status==='active_verified') {
135
+ try { await runtimeConnection?.collect(); }
136
+ catch { process.stderr.write('[craft] Runtime cleanup skipped; MCP remains active.\n'); }
137
+ }
138
+ })();
139
+ };
114
140
  server.setRequestHandler(ListToolsRequestSchema,async()=>({ tools }));
115
141
  function viewTask(task) {
116
- if (['upload','publish_prepare','publish_submit'].includes(task.kind)) {
142
+ if (task.kind === 'upload') {
117
143
  if (task.owner !== platform.account().user_id || task.platform !== platform.base) throw new Error('Draft task belongs to a different account or platform');
118
144
  const { owner, platform:target, ...view } = task;
119
- return task.kind === 'upload' && view.result ? { ...view,result:draftUploadView(view.result) } : view;
145
+ return view.result ? { ...view,result:draftUploadView({ ...view.result,platform:target }) } : view;
120
146
  }
121
147
  if (!task.result?.artifacts) return task;
122
- const { artifacts,snapshot_id,...result } = task.result;
148
+ const { artifacts,snapshot_id,source_snapshot,...result } = task.result;
123
149
  return { ...task,result };
124
150
  }
125
151
  async function checkedTask(id, name, resumeUpload = false) {
126
152
  const task = await tasks.get(id);
127
153
  if (task.kind !== 'check' || task.status !== 'completed' || !task.result?.gate?.passed) throw new Error('A completed passing game check is required');
128
154
  if (name !== undefined && task.name !== name) throw new Error('Game check belongs to a different project');
155
+ const work=currentWork();
156
+ if(!work || work.name!==task.name) throw new Error('A prepared work for this project is required');
157
+ await validateWork(work);
129
158
  const { project,engine } = await projects.describe(task.name);
130
- await leases.acquire(task.name);
131
159
  if (task.result.engine && task.result.engine !== engine) throw new Error('Game engine changed since verification');
132
160
  if (tasks.busy(task.name) || (!resumeUpload && task.result.source !== await fingerprint(project))) throw new Error('Game changed since verification; check again');
133
161
  return { task, project };
@@ -135,6 +163,7 @@ async function checkedTask(id, name, resumeUpload = false) {
135
163
  server.setRequestHandler(CallToolRequestSchema,async request=>{
136
164
  let lock;
137
165
  try {
166
+ await connectionReady;
138
167
  if (closing) throw new Error('Craft is shutting down');
139
168
  const definition = tools.find(t=>t.name === request.params.name), args = request.params.arguments ?? {};
140
169
  if (!definition) throw new Error('Unknown tool');
@@ -143,33 +172,86 @@ server.setRequestHandler(CallToolRequestSchema,async request=>{
143
172
  if (!field || (field.type === 'integer' ? !Number.isSafeInteger(value) : field.type === 'array' ? !Array.isArray(value) : typeof value !== field.type) || (field.enum && !field.enum.includes(value))) throw new Error('Invalid argument: ' + key);
144
173
  }
145
174
  for (const key of definition.inputSchema.required) if (args[key] === undefined) throw new Error('Missing argument: ' + key);
146
- if (['craft_game_prepare','craft_assets_generate','craft_assets_import','craft_game_check','craft_game_upload','craft_game_publish_prepare','craft_game_publish_review','craft_game_publish_submit','craft_game_publish_open'].includes(definition.name)) {
175
+ let work, updateWarning;
176
+ const preparing=definition.name==='craft_game_prepare';
177
+ if(preparing) {
147
178
  projects.file(args.name);
148
- if (mutations.has(args.name) || tasks.busy(args.name)) throw new Error('Project has a running operation');
149
- mutations.add(args.name); lock = args.name;
150
- await leases.acquire(args.name);
179
+ if(!args.work_id && !leases.hasRequest(args.name,args.request_key)) {
180
+ // Another work may still be creating the files inspected by the update check.
181
+ if((await leases.observe(args.name)).occupied) throw Object.assign(new Error('This project has an active work. Wait for it to finish and release before preparing another work.'),{detail:{code:'CRAFT_PROJECT_IN_USE'}});
182
+ const update=await updates.check({name:args.name,intent:args.mode,request_key:args.request_key});
183
+ if(closing) throw new Error('Craft is shutting down; project work was not started');
184
+ if(update.can_continue===false || ['pending_reconnect','incompatible','error'].includes(update.status)) {
185
+ const blocked={status:update.status,not_started:true,explicitly_not_started:true,reconnect_required:update.reconnect_required===true,update,
186
+ ...(update.connection_handoff ? {connection_handoff:update.connection_handoff} : {}),
187
+ next:update.next ?? 'Resolve the update diagnostic, then retry this prepare with the same request_key. No project work was acquired.'};
188
+ return {content:[{type:'text',text:JSON.stringify(blocked)}]};
189
+ }
190
+ if (['update_failed','offline'].includes(update.status)) updateWarning=update;
191
+ }
192
+ work=await leases.acquire(args.name,{...args,host});
193
+ if(work.task_id) {
194
+ if(work.status==='active') await validateWork(work);
195
+ return {content:[{type:'text',text:JSON.stringify(viewTask(await tasks.get(work.task_id,0)))}]};
196
+ }
197
+ } else if(workTools.has(definition.name)) {
198
+ const task=args.task_id ? await tasks.get(args.task_id) : null;
199
+ const name=args.name??task?.name;
200
+ work=await leases.assert(name,args.work_id,{ready:definition.name!=='craft_task_cancel'});
201
+ if(definition.name==='craft_task_cancel' && task.work_id!==work.work_id) throw new Error('Cannot cancel a task belonging to another work');
202
+ if(definition.name!=='craft_task_cancel') await validateWork(work);
203
+ }
204
+ if(work) {
205
+ if(mutations.has(work.name) || (definition.name!=='craft_task_cancel' && tasks.busy(work.name))) throw new Error('Project has a running operation; wait or cancel it first');
206
+ mutations.add(work.name); lock=work.name;
151
207
  }
208
+ return await withWork(work,work ? ()=>validateWork(work,{preparing:preparing || definition.name==='craft_task_cancel'}) : undefined,async()=>{
152
209
  let result;
153
210
  switch (definition.name) {
211
+ case 'craft_update_check': result=await updates.inspect(args); break;
212
+ case 'craft_update': result=await updates.install(args); break;
154
213
  case 'craft_game_info': {
155
- const project = args.name ? await projects.describe(args.name,{allowUnbound:true}) : undefined;
214
+ const occupancy=args.name ? await leases.observe(args.name) : undefined;
215
+ const project = args.name ? await projects.inspect(args.name,{full:args.full_integrity===true}) : undefined;
156
216
  if (project && args.engine && args.engine !== project.engine) throw new Error('Project engine is fixed to ' + project.engine);
157
- const selected = project ? (project.context_binding.status === 'bound' ? await projects.resourcesFor(project) : undefined) : args.engine ? await loadEngineResource(engines[args.engine].resources,args.engine,engines[args.engine].bundle.id,engines[args.engine].host) : undefined;
158
- result = { version, host, workspace:root, workspace_layout:'<workspace>/<name>', platform:platform.base, engine:project?.engine ?? selected?.engine ?? null, supported_engines:Object.keys(engines),
217
+ const selected = !project && args.engine ? await loadEngineResource(engines[args.engine].resources,args.engine,engines[args.engine].bundle.id,engines[args.engine].host) : undefined;
218
+ if(project) {
219
+ const after=await leases.observe(args.name);
220
+ if((after.occupied && after.status==='preparing') || (occupancy?.occupied && occupancy.status==='preparing')) project.preparation={status:'updating',reason:'A work is preparing context; query again after completion'};
221
+ else if(occupancy?.occupied!==after.occupied || occupancy?.generation!==after.generation) project.preparation={status:'updating',reason:'Work ownership changed during inspection; query again'};
222
+ else if(after.occupied && project.preparation.status==='ready') project.preparation.status='active';
223
+ if(project.preparation.status==='updating') project.integrity={status:'unchecked',reason:'Context changed during inspection; query again after preparation'};
224
+ }
225
+ const updateStatus=await updates.status();
226
+ result = { version, runtime:{...runtimeIdentity,busy:runtimeBusy(),activation:updateStatus.activation??{status:updateStatus.status}},update:updateStatus,host, workspace:root, workspace_layout:'<workspace>/<name>', platform:platform.base, engine:project?.engine ?? selected?.engine ?? null, supported_engines:Object.keys(engines),
159
227
  context_binding:project?.context_binding,
228
+ version_status:project?.version_status,integrity:project?.integrity,preparation:project?.preparation,registration_required:project?.registration_required,occupancy,project_context:project?.project_context,
160
229
  project:project?.project, preview:project ? await previews.status(project.project) : undefined,
161
- llm:'external AI IDE host', images:'Craft platform', aigc:assetCapabilities(selected?.engine),library:libraryCapabilities(selected?.engine),publishing:true,draft_upload:true,
162
- publication:{ local_page:true,open_tool:'craft_game_publish_open',requires:'Open the independent local page to preview the frozen build and confirm its exact reviewed materials; platform publish_enabled and ACE gates',material_visibility:'public_on_upload' },
163
- concurrency:{workspace_sessions:'multiple',project_sessions:1,release:'Close the owning Craft connection; abnormal exit expires within 30 seconds'},
164
- instructions:selected?.instructions ?? guide, context:selected?.context ?? {workflow:bootstrapWorkflow,target:{host,scope:'bootstrap'}},
230
+ llm:'external AI IDE host', images:'Craft platform', aigc:assetCapabilities(selected?.engine),library:libraryCapabilities(selected?.engine),draft_upload:true,publish_in_web:true,
231
+ concurrency:{workspace_sessions:'multiple',project_works:1,readonly_queries:'unlocked',release:'craft_game_release(name, work_id); abnormal process exit expires within 30 seconds'},
232
+ lifecycle:{version:1,prepare_modes:['create','resume'],request_key_required:true,work_id_required:true,query_updates_context:false},
233
+ instructions:project ? 'Read-only query. For editing, prepare mode=resume, poll to completion, then read the returned local context and keep work_id until release. An inspection alone does not authorize editing.' : selected?.instructions ?? guide, context:project?.context ?? selected?.context ?? {workflow:bootstrapWorkflow,target:{host,scope:'bootstrap'}},
165
234
  installed_contexts:Object.fromEntries(Object.entries(engines).map(([engine,entry])=>[engine,{host:entry.host ?? 'legacy',version:entry.bundle.version ?? null,bundle_id:entry.bundle.id}])) }; break;
166
235
  }
167
- case 'craft_game_prepare': result = await tasks.start(args.name,'prepare',async signal=>{
168
- const project = await projects.prepare(args.name,args.engine,signal,{upgrade_context:args.upgrade_context,context_bundle_id:args.context_bundle_id});
169
- await installProjectDependencies(project.project,undefined,signal);
170
- const selected = await projects.resourcesFor(project);
171
- return { ...project, workspace:root, instructions:selected.instructions, context:selected.context, next:'Open project as the host working directory. Read context.workflow, context.engine.entrypoint and context.engine.skills_index. Select skills by their descriptions and read their entrypoints relative to context.engine.directory. The project AGENTS.md and native craft-project skill restore this pinned context in later sessions. Implement, check, review and deliver.' };
172
- }); break;
236
+ case 'craft_game_prepare': {
237
+ result=await tasks.start(args.name,'prepare',async signal=>{
238
+ try {
239
+ const project=await projects.prepare(args.name,args.engine,signal,{mode:args.mode,guard:()=>leases.assert(args.name,work.work_id,{ready:false})});
240
+ await guardWork();
241
+ if(project.created) await installProjectDependencies(project.project,undefined,signal);
242
+ const selected=await projects.resourcesFor(project);
243
+ await leases.update(args.name,work.work_id,{status:'active',context_revision:project.context_revision});
244
+ return {...project,...(updateWarning?{update_warning:updateWarning}:{}),work_id:work.work_id,workspace:root,instructions:selected.instructions,context:{...selected.context,...(project.context_sync?{sync:project.context_sync}:{})},next:'Read the returned project-local workflow, engine entrypoint and skill index now. Retain work_id/context_revision throughout editing and pass work_id to workflow tools. After completing or pausing edits, record progress and call craft_game_release. A later editing task must prepare mode=resume again; an info query never updates context.'};
245
+ } catch(error) {await leases.release(args.name,work.work_id,'failed').catch(()=>{}); throw error;}
246
+ });
247
+ await leases.update(args.name,work.work_id,{task_id:result.task_id});
248
+ if(updateWarning) result={...result,update_warning:updateWarning};
249
+ break;
250
+ }
251
+ case 'craft_game_release': {
252
+ if(mutations.has(args.name) || tasks.busy(args.name)) throw new Error('Background work is running; wait or cancel and wait for cleanup before release');
253
+ result=await leases.release(args.name,args.work_id); break;
254
+ }
173
255
  case 'craft_assets_generate': {
174
256
  const inputs=generationInputs(args);
175
257
  await projects.owned(args.name);
@@ -210,16 +292,15 @@ server.setRequestHandler(CallToolRequestSchema,async request=>{
210
292
  case 'craft_task_status': result = viewTask(await tasks.get(args.task_id,args.wait_ms ?? 15000)); break;
211
293
  case 'craft_task_cancel': {
212
294
  const current = await tasks.get(args.task_id);
213
- if (['upload','publish_prepare','publish_submit'].includes(current.kind)) viewTask(current);
214
- await leases.acquire(current.name);
295
+ if (current.kind === 'upload') viewTask(current);
296
+ await leases.assert(current.name,args.work_id,{ready:false});
215
297
  const task = await tasks.cancel(args.task_id);
216
298
  result = viewTask(task);
217
299
  if (['images','assets'].includes(task.kind)) {
218
300
  try { result.remote = await assets.cancelRemote(task.name,task.request_keys); }
219
301
  catch (error) { result.remote_cancellation_confirmed = false; result.remote_error = error.message; }
220
302
  }
221
- if (task.kind === 'upload') result.next = 'Check craft_game_publish_status before retrying. A remote draft may already exist.';
222
- if (task.kind === 'publish_submit') result.next = 'Query craft_game_publish_status with the original publication_id. Cancellation does not retract a remote review or public version.';
303
+ if (task.kind === 'upload') result.next = 'Check craft_game_upload_status before retrying. A remote draft may already exist.';
223
304
  break;
224
305
  }
225
306
  case 'craft_game_review': {
@@ -240,52 +321,19 @@ server.setRequestHandler(CallToolRequestSchema,async request=>{
240
321
  const status = await platform.status();
241
322
  if (!status.authenticated) { result = loginAction(); break; }
242
323
  // An already authorized upload resumes its frozen check, even after later source edits.
243
- const resume = await drafts.hasRequest(args.name,args.check_task_id,status.user_id);
324
+ const resume = await drafts.hasRequest(args.name,args.check_task_id,status.user_id,args);
244
325
  const { task } = await checkedTask(args.check_task_id,args.name,resume);
245
- result = viewTask(await tasks.start(args.name,'upload',signal=>drafts.upload(task,status.user_id,signal),
246
- { owner:status.user_id, platform:platform.base, check_task_id:args.check_task_id }));
326
+ result = viewTask(await tasks.start(args.name,'upload',signal=>drafts.upload(task,status.user_id,signal,args),
327
+ { owner:status.user_id, platform:platform.base, check_task_id:args.check_task_id,upload_mode:args.upload_mode ?? 'current_project',request_key:args.request_key }));
247
328
  break;
248
329
  }
249
- case 'craft_game_publish_status': {
330
+ case 'craft_game_upload_status': {
250
331
  projects.file(args.name);
251
- if (Boolean(args.check_task_id) === Boolean(args.publication_id)) throw new Error('Supply exactly one of check_task_id or publication_id');
252
- const status = await platform.status();
253
- result = status.authenticated ? args.publication_id
254
- ? await publications.status(args.name,args.publication_id,status.user_id)
255
- : await drafts.status(args.name,args.check_task_id,status.user_id) : loginAction();
256
- break;
257
- }
258
- case 'craft_game_publish_open': {
259
- const status=await platform.status();
260
- result=status.authenticated ? await publishPanel.open(args.name,args.check_task_id,args.publication_id) : loginAction(); break;
261
- }
262
- case 'craft_game_publish_options': {
263
332
  const status = await platform.status();
264
- result = status.authenticated ? { ...await platform.publicationSession(status.user_id)('options'),
265
- minimum_playtest_seconds:30,display_screenshots:{ minimum:1,maximum:5 },material_visibility:'public_on_upload' } : loginAction();
266
- break;
267
- }
268
- case 'craft_game_publish_prepare': {
269
- const status = await platform.status();
270
- if (!status.authenticated) { result = loginAction(); break; }
271
- const { task,project } = await checkedTask(args.check_task_id,args.name,await drafts.hasRequest(args.name,args.check_task_id,status.user_id));
272
- result = viewTask(await tasks.start(args.name,'publish_prepare',signal=>publications.prepare(task,project,args.materials,status.user_id,signal),
273
- { owner:status.user_id,platform:platform.base,check_task_id:args.check_task_id }));
274
- break;
275
- }
276
- case 'craft_game_publish_review': {
277
- const status = await platform.status();
278
- if (!status.authenticated) { result = loginAction(); break; }
279
- return await publications.review(args.name,args.publication_id,status.user_id);
280
- }
281
- case 'craft_game_publish_submit': {
282
- const status = await platform.status();
283
- if (!status.authenticated) { result = loginAction(); break; }
284
- result = viewTask(await tasks.start(args.name,'publish_submit',signal=>publications.submit(args.name,args.publication_id,args.revision,args.confirmed,status.user_id,signal),
285
- { owner:status.user_id,platform:platform.base,publication_id:args.publication_id }));
333
+ result = status.authenticated ? await drafts.status(args.name,args.check_task_id,status.user_id,undefined,args) : loginAction();
286
334
  break;
287
335
  }
288
- case 'craft_preview_stop': await leases.acquire(args.name); result = await previews.stop(await projects.owned(args.name)); break;
336
+ case 'craft_preview_stop': await guardWork(); result = await previews.stop(await projects.owned(args.name)); break;
289
337
  case 'craft_auth_open': {
290
338
  const status = await platform.status();
291
339
  result = !status.authenticated ? loginAction() :
@@ -298,19 +346,30 @@ server.setRequestHandler(CallToolRequestSchema,async request=>{
298
346
  break;
299
347
  }
300
348
  case 'craft_auth_logout': {
349
+ authInteraction=false;
301
350
  result = platform.logout();
302
351
  if (connectorAuth) result.user_message = '本进程已退出登录。要移除宿主 AI IDE 保存的凭证,请在 MCP 凭证设置中断开或清除凭证;重新连接会再次注入。';
303
352
  break;
304
353
  }
305
354
  }
355
+ if(work && !preparing && definition.name!=='craft_task_cancel') await guardWork();
306
356
  return { content:[{ type:'text',text:JSON.stringify(result) }] };
357
+ });
307
358
  } catch (error) { return { isError:true,content:[{ type:'text',text:JSON.stringify({ error:error.message,...error.detail }) }] }; }
308
359
  finally { if (lock) mutations.delete(lock); }
309
360
  });
310
- async function shutdown() {
311
- if (closing) return;
361
+ let shutdownPromise;
362
+ function shutdown() {
363
+ if(shutdownPromise) return shutdownPromise;
312
364
  closing = true;
313
- await tasks.close(); await leases.close(); await panel.close(); await server.close();
365
+ shutdownPromise=(async()=>{
366
+ await updates.close();
367
+ await connectionReady.catch(()=>{});
368
+ await tasks.close(); await leases.close(); await panel.close(); await server.close();
369
+ try { await runtimeConnection?.close(); }
370
+ catch { process.stderr.write('[craft] Runtime cleanup skipped during shutdown.\n'); }
371
+ })();
372
+ return shutdownPromise;
314
373
  }
315
374
  for (const signal of ['SIGINT','SIGTERM']) process.once(signal,()=>{ void shutdown().then(()=>process.exit(0)); });
316
375
  process.stdin.once('end',()=>{ void shutdown(); });
@@ -11,8 +11,14 @@ process.env.CLIENT_WORKSPACE_ROOT = workspace;
11
11
  process.env.CRAFT_WEB_URL ??= pkg.craft.platform;
12
12
  const profile = createHash('sha256').update(workspace + '\n' + process.env.CRAFT_WEB_URL).digest('hex').slice(0,16);
13
13
  process.env.CLIENT_DATA_DIR ||= path.join(getAppDataRoot(),profile);
14
- process.env.PLAYWRIGHT_PACKAGE_ROOT ||= fileURLToPath(new URL('../../node_modules/',import.meta.url));
15
- process.env.CRAFT_MCP_RESOURCES_DIR ||= fileURLToPath(new URL('../../resources/',import.meta.url));
14
+ // A managed connection runs one complete package. Environment values left by
15
+ // an older installation must not attach another package's resources or tools.
16
+ const packagePaths={PLAYWRIGHT_PACKAGE_ROOT:fileURLToPath(new URL('../../node_modules/',import.meta.url)),
17
+ CRAFT_MCP_RESOURCES_DIR:fileURLToPath(new URL('../../resources/',import.meta.url))};
18
+ for(const [key,value] of Object.entries(packagePaths)) {
19
+ if(process.env.CRAFT_INSTALLATION_FILE) process.env[key]=value;
20
+ else process.env[key] ||= value;
21
+ }
16
22
  // Select profile paths before loading the server and its credential store.
17
23
  try { await import('./server.mjs'); }
18
24
  catch (error) {
@@ -0,0 +1,107 @@
1
+ import path from 'node:path';
2
+ import { isDeepStrictEqual } from 'node:util';
3
+ import { loadEngineResources } from '../game-workflow/engines.mjs';
4
+ import { readContextLock, checkProjectCompatibility } from '../game-workflow/project-bundles.mjs';
5
+ import { checkForUpdate, readUpdateStatus, readInstallation, confirmActiveInstallation } from '../integrations/updates.mjs';
6
+ import { connectionHandoff } from '../integrations/connection-handoff.mjs';
7
+
8
+ // This connection owns one complete package for its entire lifetime. An
9
+ // installer probe or another connection can never replace its runtime identity.
10
+ export class UpdateSession {
11
+ constructor({installationFile, current, projects, host, workspace, platform, busy}) {
12
+ Object.assign(this,{installationFile,current,projects,host,workspace,platform,busy});
13
+ this.operations=new Set();
14
+ this.receipts=new Map();
15
+ this.closing=false;
16
+ }
17
+ get activeOperations() { return this.operations.size; }
18
+ run(operation) {
19
+ if(this.closing) return Promise.resolve({status:'error',code:'connection_closing',message:'Craft is shutting down; reconnect before starting new work',
20
+ current:this.current,can_continue:false,activation_required:false,explicitly_not_started:true});
21
+ const pending=Promise.resolve().then(operation);
22
+ this.operations.add(pending);
23
+ return pending.finally(()=>this.operations.delete(pending));
24
+ }
25
+ async close() {
26
+ this.closing=true;
27
+ // Installation/Skill/config commits and connection receipts must finish or
28
+ // roll back before the process acknowledges a graceful shutdown.
29
+ await Promise.allSettled([...this.operations]);
30
+ }
31
+ async scopeError() {
32
+ if(!this.installationFile) return null;
33
+ try {
34
+ const state=await readInstallation(this.installationFile);
35
+ const normalize=value=>{const resolved=path.resolve(value);return process.platform==='win32'?resolved.toLowerCase():resolved;};
36
+ if(state.host!==this.host || normalize(state.workspace)!==normalize(this.workspace) || new URL(state.platform).origin!==new URL(this.platform).origin) throw new Error('Craft installation host, workspace or platform differs from this connection; run install with the intended scope and reconnect');
37
+ return null;
38
+ } catch(error) {return {status:'error',code:'installation_scope_mismatch',message:error.message,current:this.current,can_continue:false,activation_required:false};}
39
+ }
40
+ async status() {
41
+ const error=await this.scopeError();if(error) return error;
42
+ if(this.connectionError) return this.connectionError;
43
+ return this.withHandoff({...await readUpdateStatus({installationFile:this.installationFile,current:this.current}),
44
+ ...(this.last ? {last_check:this.last} : {})},{intent:'inspect'});
45
+ }
46
+ withHandoff(result,{intent='inspect',name,request_key,excludeUpdate=false}={}) {
47
+ if(!result.reconnect_required || !result.target || ['error','incompatible','migration_required'].includes(result.status)) return result;
48
+ const busy=this.busy?.({excludeUpdate});
49
+ const handoff=connectionHandoff({host:this.host,target:result.target,current:this.current,workspace:this.workspace,platform:this.platform,
50
+ busy,intent,name,requestKey:request_key});
51
+ return {...result,...(busy?{busy}:{}),connection_handoff:handoff,next:handoff.next};
52
+ }
53
+ connected() { return this.run(()=>this.confirmConnection()); }
54
+ async confirmConnection() {
55
+ if(!this.installationFile) return {status:'unmanaged'};
56
+ const error=await this.scopeError();if(error) return this.connectionError=error;
57
+ try {
58
+ const status=await readUpdateStatus({installationFile:this.installationFile,current:this.current});
59
+ if(status.status==='error') return this.connectionError=status;
60
+ if(status.activation?.status!=='active_verified') return this.withHandoff(status,{excludeUpdate:true});
61
+ return await confirmActiveInstallation({installationFile:this.installationFile,current:this.current});
62
+ }
63
+ catch(error) {
64
+ return this.connectionError={status:'error',code:'connection_verification_failed',message:error.message,current:this.current,
65
+ can_continue:false,activation_required:false,reconnect_required:true,explicitly_not_started:true};
66
+ }
67
+ }
68
+ check(args={}) { return this.run(()=>this.checkCurrent(args)); }
69
+ inspect({name,request_key}={}) { return this.check({name,request_key,intent:'inspect'}); }
70
+ install({name,request_key,mode='auto'}={}) {
71
+ if(!request_key) throw new Error('Update request_key is required');
72
+ if(!['auto','manual'].includes(mode)) throw new Error('Invalid update mode');
73
+ return this.check({name,request_key,intent:mode==='manual'?'update':'auto'});
74
+ }
75
+ async checkCurrent({name,intent='inspect',request_key}={}) {
76
+ const error=await this.scopeError();if(error) return error;
77
+ if(this.connectionError) return this.connectionError;
78
+ if(name!==undefined) this.projects.file(name);
79
+ if(intent==='resume' && !name) throw new Error('Project name is required when checking a resume');
80
+ if(request_key!==undefined && !/^[a-zA-Z0-9._:-]{1,128}$/.test(request_key)) throw new Error('Invalid update request_key');
81
+ const project=name && ['inspect','resume','auto','update'].includes(intent) ? await this.projects.inspect(name) : null;
82
+ const projectCompatibility=project ? async packageRoot=>{
83
+ const {engines}=await loadEngineResources(path.join(packageRoot,'resources'),this.host);
84
+ const candidate=engines[project.engine];
85
+ await checkProjectCompatibility(project.project,candidate.bundle);
86
+ const lock=await readContextLock(project.project,project.engine);
87
+ if(lock?.schema>=2 && !isDeepStrictEqual(lock.compatibility,candidate.bundle.compatibility)) throw new Error('New Craft context is incompatible with this project; keep its engine and migrate explicitly');
88
+ const previous=lock?.contexts?.[this.host];
89
+ if(previous && previous.bundle_id!==candidate.bundle.id) {
90
+ const difference=candidate.bundle.version.split('.').map((value,i)=>Number(value)-Number(previous.version?.split('.')[i])).find(value=>value!==0)??0;
91
+ if(!Number.isFinite(difference)||difference<=0) throw new Error('Candidate context is older or has a conflicting version for this project');
92
+ }
93
+ } : undefined;
94
+ const result=await checkForUpdate({installationFile:this.installationFile,current:this.current,intent,
95
+ requestKey:request_key ? `${intent==='create'?'create':`${name??'global'}:${intent}`}:${request_key}` : undefined,projectCompatibility,
96
+ registryReceipt:request_key ? this.receipts.get(request_key) : undefined});
97
+ if(request_key && result.remote && result.source && result.checked_at) {
98
+ // Cache metadata, never a project's compatibility verdict. Different
99
+ // projects and preparation retries must be validated independently.
100
+ this.receipts.set(request_key,{source_key:JSON.stringify(result.source),remote:result.remote,checked_at:result.checked_at});
101
+ for(const [key,value] of this.receipts) if(Date.now()-Date.parse(value.checked_at)>=300000) this.receipts.delete(key);
102
+ while(this.receipts.size>128) this.receipts.delete(this.receipts.keys().next().value);
103
+ }
104
+ this.last=this.withHandoff(result,{intent,name,request_key,excludeUpdate:true});
105
+ return this.last;
106
+ }
107
+ }