@craft_eco/craft-mcp 0.1.34-beta.1 → 0.1.34-beta.2

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 (360) hide show
  1. package/README.md +21 -8
  2. package/bin/craft-mcp.mjs +1 -1
  3. package/dist-server/game-workflow/art-previews.mjs +71 -0
  4. package/dist-server/game-workflow/bundle-files.mjs +12 -3
  5. package/dist-server/game-workflow/bundle-template.mjs +37 -37
  6. package/dist-server/game-workflow/local-context.mjs +2 -0
  7. package/dist-server/game-workflow/native-context.mjs +18 -5
  8. package/dist-server/game-workflow/project-art-previews.mjs +63 -0
  9. package/dist-server/game-workflow/project-bundles.mjs +97 -21
  10. package/dist-server/game-workflow/project-context.mjs +3 -3
  11. package/dist-server/game-workflow/projects.mjs +15 -13
  12. package/dist-server/integrations/files.mjs +3 -1
  13. package/dist-server/integrations/install-source.mjs +44 -0
  14. package/dist-server/integrations/install.mjs +87 -23
  15. package/dist-server/integrations/project-setup.mjs +6 -4
  16. package/dist-server/integrations/updates.mjs +15 -4
  17. package/dist-server/mcp/server.mjs +5 -4
  18. package/dist-server/mcp/update-session.mjs +26 -12
  19. package/dist-server/upstream/craft-aigc.mjs +11 -2
  20. package/dist-server/upstream/draft-audit.mjs +52 -6
  21. package/package.json +1 -1
  22. package/resources/craft-create/SKILL.md +1 -1
  23. package/resources/craft-update/SKILL.md +1 -1
  24. package/resources/targets/claude/js/js/bundle.json +5 -5
  25. package/resources/targets/claude/js/recovery.md +1 -1
  26. package/resources/targets/claude/js/target.json +1 -1
  27. package/resources/targets/claude/js3d/js3d/bundle.json +25 -23
  28. package/resources/targets/claude/js3d/js3d/context/skills/game-art-style/SKILL.md +1 -1
  29. package/resources/targets/claude/js3d/js3d/context/skills/game-art-style/references/sources.md +1 -1
  30. package/resources/targets/claude/js3d/js3d/context/skills/game-art-style/references/styles/cartoon.md +1 -1
  31. package/resources/targets/claude/js3d/js3d/context/skills/game-art-style/references/styles/comic.md +1 -1
  32. package/resources/targets/claude/js3d/js3d/context/skills/game-art-style/references/styles/cozy.md +1 -1
  33. package/resources/targets/claude/js3d/js3d/context/skills/game-art-style/references/styles/cyber.md +1 -1
  34. package/resources/targets/claude/js3d/js3d/context/skills/game-art-style/references/styles/horror.md +1 -1
  35. package/resources/targets/claude/js3d/js3d/context/skills/game-art-style/references/styles/lowpoly.md +1 -1
  36. package/resources/targets/claude/js3d/js3d/context/skills/game-art-style/references/styles/paper.md +1 -1
  37. package/resources/targets/claude/js3d/js3d/context/skills/game-art-style/references/styles/voxel.md +1 -1
  38. package/resources/targets/claude/js3d/recovery.md +1 -1
  39. package/resources/targets/claude/js3d/target.json +1 -1
  40. package/resources/targets/codebuddy/js/js/bundle.json +5 -5
  41. package/resources/targets/codebuddy/js/recovery.md +1 -1
  42. package/resources/targets/codebuddy/js/target.json +1 -1
  43. package/resources/targets/codebuddy/js3d/js3d/bundle.json +25 -23
  44. package/resources/targets/codebuddy/js3d/js3d/context/skills/game-art-style/SKILL.md +1 -1
  45. package/resources/targets/codebuddy/js3d/js3d/context/skills/game-art-style/references/sources.md +1 -1
  46. package/resources/targets/codebuddy/js3d/js3d/context/skills/game-art-style/references/styles/cartoon.md +1 -1
  47. package/resources/targets/codebuddy/js3d/js3d/context/skills/game-art-style/references/styles/comic.md +1 -1
  48. package/resources/targets/codebuddy/js3d/js3d/context/skills/game-art-style/references/styles/cozy.md +1 -1
  49. package/resources/targets/codebuddy/js3d/js3d/context/skills/game-art-style/references/styles/cyber.md +1 -1
  50. package/resources/targets/codebuddy/js3d/js3d/context/skills/game-art-style/references/styles/horror.md +1 -1
  51. package/resources/targets/codebuddy/js3d/js3d/context/skills/game-art-style/references/styles/lowpoly.md +1 -1
  52. package/resources/targets/codebuddy/js3d/js3d/context/skills/game-art-style/references/styles/paper.md +1 -1
  53. package/resources/targets/codebuddy/js3d/js3d/context/skills/game-art-style/references/styles/voxel.md +1 -1
  54. package/resources/targets/codebuddy/js3d/recovery.md +1 -1
  55. package/resources/targets/codebuddy/js3d/target.json +1 -1
  56. package/resources/targets/codex/js/js/bundle.json +5 -5
  57. package/resources/targets/codex/js/recovery.md +1 -1
  58. package/resources/targets/codex/js/target.json +1 -1
  59. package/resources/targets/codex/js3d/js3d/bundle.json +25 -23
  60. package/resources/targets/codex/js3d/js3d/context/skills/game-art-style/SKILL.md +1 -1
  61. package/resources/targets/codex/js3d/js3d/context/skills/game-art-style/references/sources.md +1 -1
  62. package/resources/targets/codex/js3d/js3d/context/skills/game-art-style/references/styles/cartoon.md +1 -1
  63. package/resources/targets/codex/js3d/js3d/context/skills/game-art-style/references/styles/comic.md +1 -1
  64. package/resources/targets/codex/js3d/js3d/context/skills/game-art-style/references/styles/cozy.md +1 -1
  65. package/resources/targets/codex/js3d/js3d/context/skills/game-art-style/references/styles/cyber.md +1 -1
  66. package/resources/targets/codex/js3d/js3d/context/skills/game-art-style/references/styles/horror.md +1 -1
  67. package/resources/targets/codex/js3d/js3d/context/skills/game-art-style/references/styles/lowpoly.md +1 -1
  68. package/resources/targets/codex/js3d/js3d/context/skills/game-art-style/references/styles/paper.md +1 -1
  69. package/resources/targets/codex/js3d/js3d/context/skills/game-art-style/references/styles/voxel.md +1 -1
  70. package/resources/targets/codex/js3d/recovery.md +1 -1
  71. package/resources/targets/codex/js3d/target.json +1 -1
  72. package/resources/targets/comate/js/js/bundle.json +5 -5
  73. package/resources/targets/comate/js/recovery.md +1 -1
  74. package/resources/targets/comate/js/target.json +1 -1
  75. package/resources/targets/comate/js3d/js3d/bundle.json +25 -23
  76. package/resources/targets/comate/js3d/js3d/context/skills/game-art-style/SKILL.md +1 -1
  77. package/resources/targets/comate/js3d/js3d/context/skills/game-art-style/references/sources.md +1 -1
  78. package/resources/targets/comate/js3d/js3d/context/skills/game-art-style/references/styles/cartoon.md +1 -1
  79. package/resources/targets/comate/js3d/js3d/context/skills/game-art-style/references/styles/comic.md +1 -1
  80. package/resources/targets/comate/js3d/js3d/context/skills/game-art-style/references/styles/cozy.md +1 -1
  81. package/resources/targets/comate/js3d/js3d/context/skills/game-art-style/references/styles/cyber.md +1 -1
  82. package/resources/targets/comate/js3d/js3d/context/skills/game-art-style/references/styles/horror.md +1 -1
  83. package/resources/targets/comate/js3d/js3d/context/skills/game-art-style/references/styles/lowpoly.md +1 -1
  84. package/resources/targets/comate/js3d/js3d/context/skills/game-art-style/references/styles/paper.md +1 -1
  85. package/resources/targets/comate/js3d/js3d/context/skills/game-art-style/references/styles/voxel.md +1 -1
  86. package/resources/targets/comate/js3d/recovery.md +1 -1
  87. package/resources/targets/comate/js3d/target.json +1 -1
  88. package/resources/targets/cursor/js/js/bundle.json +5 -5
  89. package/resources/targets/cursor/js/recovery.md +1 -1
  90. package/resources/targets/cursor/js/target.json +1 -1
  91. package/resources/targets/cursor/js3d/js3d/bundle.json +25 -23
  92. package/resources/targets/cursor/js3d/js3d/context/skills/game-art-style/SKILL.md +1 -1
  93. package/resources/targets/cursor/js3d/js3d/context/skills/game-art-style/references/sources.md +1 -1
  94. package/resources/targets/cursor/js3d/js3d/context/skills/game-art-style/references/styles/cartoon.md +1 -1
  95. package/resources/targets/cursor/js3d/js3d/context/skills/game-art-style/references/styles/comic.md +1 -1
  96. package/resources/targets/cursor/js3d/js3d/context/skills/game-art-style/references/styles/cozy.md +1 -1
  97. package/resources/targets/cursor/js3d/js3d/context/skills/game-art-style/references/styles/cyber.md +1 -1
  98. package/resources/targets/cursor/js3d/js3d/context/skills/game-art-style/references/styles/horror.md +1 -1
  99. package/resources/targets/cursor/js3d/js3d/context/skills/game-art-style/references/styles/lowpoly.md +1 -1
  100. package/resources/targets/cursor/js3d/js3d/context/skills/game-art-style/references/styles/paper.md +1 -1
  101. package/resources/targets/cursor/js3d/js3d/context/skills/game-art-style/references/styles/voxel.md +1 -1
  102. package/resources/targets/cursor/js3d/recovery.md +1 -1
  103. package/resources/targets/cursor/js3d/target.json +1 -1
  104. package/resources/targets/dsh/js/js/bundle.json +5 -5
  105. package/resources/targets/dsh/js/recovery.md +1 -1
  106. package/resources/targets/dsh/js/target.json +1 -1
  107. package/resources/targets/dsh/js3d/js3d/bundle.json +25 -23
  108. package/resources/targets/dsh/js3d/js3d/context/skills/game-art-style/SKILL.md +1 -1
  109. package/resources/targets/dsh/js3d/js3d/context/skills/game-art-style/references/sources.md +1 -1
  110. package/resources/targets/dsh/js3d/js3d/context/skills/game-art-style/references/styles/cartoon.md +1 -1
  111. package/resources/targets/dsh/js3d/js3d/context/skills/game-art-style/references/styles/comic.md +1 -1
  112. package/resources/targets/dsh/js3d/js3d/context/skills/game-art-style/references/styles/cozy.md +1 -1
  113. package/resources/targets/dsh/js3d/js3d/context/skills/game-art-style/references/styles/cyber.md +1 -1
  114. package/resources/targets/dsh/js3d/js3d/context/skills/game-art-style/references/styles/horror.md +1 -1
  115. package/resources/targets/dsh/js3d/js3d/context/skills/game-art-style/references/styles/lowpoly.md +1 -1
  116. package/resources/targets/dsh/js3d/js3d/context/skills/game-art-style/references/styles/paper.md +1 -1
  117. package/resources/targets/dsh/js3d/js3d/context/skills/game-art-style/references/styles/voxel.md +1 -1
  118. package/resources/targets/dsh/js3d/recovery.md +1 -1
  119. package/resources/targets/dsh/js3d/target.json +1 -1
  120. package/resources/targets/index.json +56 -56
  121. package/resources/targets/kimi/js/js/bundle.json +5 -5
  122. package/resources/targets/kimi/js/recovery.md +1 -1
  123. package/resources/targets/kimi/js/target.json +1 -1
  124. package/resources/targets/kimi/js3d/js3d/bundle.json +25 -23
  125. package/resources/targets/kimi/js3d/js3d/context/skills/game-art-style/SKILL.md +1 -1
  126. package/resources/targets/kimi/js3d/js3d/context/skills/game-art-style/references/sources.md +1 -1
  127. package/resources/targets/kimi/js3d/js3d/context/skills/game-art-style/references/styles/cartoon.md +1 -1
  128. package/resources/targets/kimi/js3d/js3d/context/skills/game-art-style/references/styles/comic.md +1 -1
  129. package/resources/targets/kimi/js3d/js3d/context/skills/game-art-style/references/styles/cozy.md +1 -1
  130. package/resources/targets/kimi/js3d/js3d/context/skills/game-art-style/references/styles/cyber.md +1 -1
  131. package/resources/targets/kimi/js3d/js3d/context/skills/game-art-style/references/styles/horror.md +1 -1
  132. package/resources/targets/kimi/js3d/js3d/context/skills/game-art-style/references/styles/lowpoly.md +1 -1
  133. package/resources/targets/kimi/js3d/js3d/context/skills/game-art-style/references/styles/paper.md +1 -1
  134. package/resources/targets/kimi/js3d/js3d/context/skills/game-art-style/references/styles/voxel.md +1 -1
  135. package/resources/targets/kimi/js3d/recovery.md +1 -1
  136. package/resources/targets/kimi/js3d/target.json +1 -1
  137. package/resources/targets/opencode/js/js/bundle.json +5 -5
  138. package/resources/targets/opencode/js/recovery.md +1 -1
  139. package/resources/targets/opencode/js/target.json +1 -1
  140. package/resources/targets/opencode/js3d/js3d/bundle.json +25 -23
  141. package/resources/targets/opencode/js3d/js3d/context/skills/game-art-style/SKILL.md +1 -1
  142. package/resources/targets/opencode/js3d/js3d/context/skills/game-art-style/references/sources.md +1 -1
  143. package/resources/targets/opencode/js3d/js3d/context/skills/game-art-style/references/styles/cartoon.md +1 -1
  144. package/resources/targets/opencode/js3d/js3d/context/skills/game-art-style/references/styles/comic.md +1 -1
  145. package/resources/targets/opencode/js3d/js3d/context/skills/game-art-style/references/styles/cozy.md +1 -1
  146. package/resources/targets/opencode/js3d/js3d/context/skills/game-art-style/references/styles/cyber.md +1 -1
  147. package/resources/targets/opencode/js3d/js3d/context/skills/game-art-style/references/styles/horror.md +1 -1
  148. package/resources/targets/opencode/js3d/js3d/context/skills/game-art-style/references/styles/lowpoly.md +1 -1
  149. package/resources/targets/opencode/js3d/js3d/context/skills/game-art-style/references/styles/paper.md +1 -1
  150. package/resources/targets/opencode/js3d/js3d/context/skills/game-art-style/references/styles/voxel.md +1 -1
  151. package/resources/targets/opencode/js3d/recovery.md +1 -1
  152. package/resources/targets/opencode/js3d/target.json +1 -1
  153. package/resources/targets/qoder/js/js/bundle.json +5 -5
  154. package/resources/targets/qoder/js/recovery.md +1 -1
  155. package/resources/targets/qoder/js/target.json +1 -1
  156. package/resources/targets/qoder/js3d/js3d/bundle.json +25 -23
  157. package/resources/targets/qoder/js3d/js3d/context/skills/game-art-style/SKILL.md +1 -1
  158. package/resources/targets/qoder/js3d/js3d/context/skills/game-art-style/references/sources.md +1 -1
  159. package/resources/targets/qoder/js3d/js3d/context/skills/game-art-style/references/styles/cartoon.md +1 -1
  160. package/resources/targets/qoder/js3d/js3d/context/skills/game-art-style/references/styles/comic.md +1 -1
  161. package/resources/targets/qoder/js3d/js3d/context/skills/game-art-style/references/styles/cozy.md +1 -1
  162. package/resources/targets/qoder/js3d/js3d/context/skills/game-art-style/references/styles/cyber.md +1 -1
  163. package/resources/targets/qoder/js3d/js3d/context/skills/game-art-style/references/styles/horror.md +1 -1
  164. package/resources/targets/qoder/js3d/js3d/context/skills/game-art-style/references/styles/lowpoly.md +1 -1
  165. package/resources/targets/qoder/js3d/js3d/context/skills/game-art-style/references/styles/paper.md +1 -1
  166. package/resources/targets/qoder/js3d/js3d/context/skills/game-art-style/references/styles/voxel.md +1 -1
  167. package/resources/targets/qoder/js3d/recovery.md +1 -1
  168. package/resources/targets/qoder/js3d/target.json +1 -1
  169. package/resources/targets/qoder-cn/js/js/bundle.json +5 -5
  170. package/resources/targets/qoder-cn/js/recovery.md +1 -1
  171. package/resources/targets/qoder-cn/js/target.json +1 -1
  172. package/resources/targets/qoder-cn/js3d/js3d/bundle.json +25 -23
  173. package/resources/targets/qoder-cn/js3d/js3d/context/skills/game-art-style/SKILL.md +1 -1
  174. package/resources/targets/qoder-cn/js3d/js3d/context/skills/game-art-style/references/sources.md +1 -1
  175. package/resources/targets/qoder-cn/js3d/js3d/context/skills/game-art-style/references/styles/cartoon.md +1 -1
  176. package/resources/targets/qoder-cn/js3d/js3d/context/skills/game-art-style/references/styles/comic.md +1 -1
  177. package/resources/targets/qoder-cn/js3d/js3d/context/skills/game-art-style/references/styles/cozy.md +1 -1
  178. package/resources/targets/qoder-cn/js3d/js3d/context/skills/game-art-style/references/styles/cyber.md +1 -1
  179. package/resources/targets/qoder-cn/js3d/js3d/context/skills/game-art-style/references/styles/horror.md +1 -1
  180. package/resources/targets/qoder-cn/js3d/js3d/context/skills/game-art-style/references/styles/lowpoly.md +1 -1
  181. package/resources/targets/qoder-cn/js3d/js3d/context/skills/game-art-style/references/styles/paper.md +1 -1
  182. package/resources/targets/qoder-cn/js3d/js3d/context/skills/game-art-style/references/styles/voxel.md +1 -1
  183. package/resources/targets/qoder-cn/js3d/recovery.md +1 -1
  184. package/resources/targets/qoder-cn/js3d/target.json +1 -1
  185. package/resources/targets/qwen/js/js/bundle.json +5 -5
  186. package/resources/targets/qwen/js/recovery.md +1 -1
  187. package/resources/targets/qwen/js/target.json +1 -1
  188. package/resources/targets/qwen/js3d/js3d/bundle.json +25 -23
  189. package/resources/targets/qwen/js3d/js3d/context/skills/game-art-style/SKILL.md +1 -1
  190. package/resources/targets/qwen/js3d/js3d/context/skills/game-art-style/references/sources.md +1 -1
  191. package/resources/targets/qwen/js3d/js3d/context/skills/game-art-style/references/styles/cartoon.md +1 -1
  192. package/resources/targets/qwen/js3d/js3d/context/skills/game-art-style/references/styles/comic.md +1 -1
  193. package/resources/targets/qwen/js3d/js3d/context/skills/game-art-style/references/styles/cozy.md +1 -1
  194. package/resources/targets/qwen/js3d/js3d/context/skills/game-art-style/references/styles/cyber.md +1 -1
  195. package/resources/targets/qwen/js3d/js3d/context/skills/game-art-style/references/styles/horror.md +1 -1
  196. package/resources/targets/qwen/js3d/js3d/context/skills/game-art-style/references/styles/lowpoly.md +1 -1
  197. package/resources/targets/qwen/js3d/js3d/context/skills/game-art-style/references/styles/paper.md +1 -1
  198. package/resources/targets/qwen/js3d/js3d/context/skills/game-art-style/references/styles/voxel.md +1 -1
  199. package/resources/targets/qwen/js3d/recovery.md +1 -1
  200. package/resources/targets/qwen/js3d/target.json +1 -1
  201. package/resources/targets/trae/js/js/bundle.json +5 -5
  202. package/resources/targets/trae/js/recovery.md +1 -1
  203. package/resources/targets/trae/js/target.json +1 -1
  204. package/resources/targets/trae/js3d/js3d/bundle.json +25 -23
  205. package/resources/targets/trae/js3d/js3d/context/skills/game-art-style/SKILL.md +1 -1
  206. package/resources/targets/trae/js3d/js3d/context/skills/game-art-style/references/sources.md +1 -1
  207. package/resources/targets/trae/js3d/js3d/context/skills/game-art-style/references/styles/cartoon.md +1 -1
  208. package/resources/targets/trae/js3d/js3d/context/skills/game-art-style/references/styles/comic.md +1 -1
  209. package/resources/targets/trae/js3d/js3d/context/skills/game-art-style/references/styles/cozy.md +1 -1
  210. package/resources/targets/trae/js3d/js3d/context/skills/game-art-style/references/styles/cyber.md +1 -1
  211. package/resources/targets/trae/js3d/js3d/context/skills/game-art-style/references/styles/horror.md +1 -1
  212. package/resources/targets/trae/js3d/js3d/context/skills/game-art-style/references/styles/lowpoly.md +1 -1
  213. package/resources/targets/trae/js3d/js3d/context/skills/game-art-style/references/styles/paper.md +1 -1
  214. package/resources/targets/trae/js3d/js3d/context/skills/game-art-style/references/styles/voxel.md +1 -1
  215. package/resources/targets/trae/js3d/recovery.md +1 -1
  216. package/resources/targets/trae/js3d/target.json +1 -1
  217. package/resources/targets/workbuddy/js/js/bundle.json +5 -5
  218. package/resources/targets/workbuddy/js/recovery.md +1 -1
  219. package/resources/targets/workbuddy/js/target.json +1 -1
  220. package/resources/targets/workbuddy/js3d/js3d/bundle.json +25 -23
  221. package/resources/targets/workbuddy/js3d/js3d/context/skills/game-art-style/SKILL.md +1 -1
  222. package/resources/targets/workbuddy/js3d/js3d/context/skills/game-art-style/references/sources.md +1 -1
  223. package/resources/targets/workbuddy/js3d/js3d/context/skills/game-art-style/references/styles/cartoon.md +1 -1
  224. package/resources/targets/workbuddy/js3d/js3d/context/skills/game-art-style/references/styles/comic.md +1 -1
  225. package/resources/targets/workbuddy/js3d/js3d/context/skills/game-art-style/references/styles/cozy.md +1 -1
  226. package/resources/targets/workbuddy/js3d/js3d/context/skills/game-art-style/references/styles/cyber.md +1 -1
  227. package/resources/targets/workbuddy/js3d/js3d/context/skills/game-art-style/references/styles/horror.md +1 -1
  228. package/resources/targets/workbuddy/js3d/js3d/context/skills/game-art-style/references/styles/lowpoly.md +1 -1
  229. package/resources/targets/workbuddy/js3d/js3d/context/skills/game-art-style/references/styles/paper.md +1 -1
  230. package/resources/targets/workbuddy/js3d/js3d/context/skills/game-art-style/references/styles/voxel.md +1 -1
  231. package/resources/targets/workbuddy/js3d/recovery.md +1 -1
  232. package/resources/targets/workbuddy/js3d/target.json +1 -1
  233. package/resources/targets/zcode/js/js/bundle.json +5 -5
  234. package/resources/targets/zcode/js/recovery.md +1 -1
  235. package/resources/targets/zcode/js/target.json +1 -1
  236. package/resources/targets/zcode/js3d/js3d/bundle.json +25 -23
  237. package/resources/targets/zcode/js3d/js3d/context/skills/game-art-style/SKILL.md +1 -1
  238. package/resources/targets/zcode/js3d/js3d/context/skills/game-art-style/references/sources.md +1 -1
  239. package/resources/targets/zcode/js3d/js3d/context/skills/game-art-style/references/styles/cartoon.md +1 -1
  240. package/resources/targets/zcode/js3d/js3d/context/skills/game-art-style/references/styles/comic.md +1 -1
  241. package/resources/targets/zcode/js3d/js3d/context/skills/game-art-style/references/styles/cozy.md +1 -1
  242. package/resources/targets/zcode/js3d/js3d/context/skills/game-art-style/references/styles/cyber.md +1 -1
  243. package/resources/targets/zcode/js3d/js3d/context/skills/game-art-style/references/styles/horror.md +1 -1
  244. package/resources/targets/zcode/js3d/js3d/context/skills/game-art-style/references/styles/lowpoly.md +1 -1
  245. package/resources/targets/zcode/js3d/js3d/context/skills/game-art-style/references/styles/paper.md +1 -1
  246. package/resources/targets/zcode/js3d/js3d/context/skills/game-art-style/references/styles/voxel.md +1 -1
  247. package/resources/targets/zcode/js3d/recovery.md +1 -1
  248. package/resources/targets/zcode/js3d/target.json +1 -1
  249. package/resources/targets/codebuddy/js3d/js3d/context/skills/game-art-style/assets/previews/cartoon.webp +0 -0
  250. package/resources/targets/codebuddy/js3d/js3d/context/skills/game-art-style/assets/previews/comic.webp +0 -0
  251. package/resources/targets/codebuddy/js3d/js3d/context/skills/game-art-style/assets/previews/cozy.webp +0 -0
  252. package/resources/targets/codebuddy/js3d/js3d/context/skills/game-art-style/assets/previews/cyber.webp +0 -0
  253. package/resources/targets/codebuddy/js3d/js3d/context/skills/game-art-style/assets/previews/horror.webp +0 -0
  254. package/resources/targets/codebuddy/js3d/js3d/context/skills/game-art-style/assets/previews/lowpoly.webp +0 -0
  255. package/resources/targets/codebuddy/js3d/js3d/context/skills/game-art-style/assets/previews/paper.webp +0 -0
  256. package/resources/targets/codebuddy/js3d/js3d/context/skills/game-art-style/assets/previews/voxel.webp +0 -0
  257. package/resources/targets/codex/js3d/js3d/context/skills/game-art-style/assets/previews/cartoon.webp +0 -0
  258. package/resources/targets/codex/js3d/js3d/context/skills/game-art-style/assets/previews/comic.webp +0 -0
  259. package/resources/targets/codex/js3d/js3d/context/skills/game-art-style/assets/previews/cozy.webp +0 -0
  260. package/resources/targets/codex/js3d/js3d/context/skills/game-art-style/assets/previews/cyber.webp +0 -0
  261. package/resources/targets/codex/js3d/js3d/context/skills/game-art-style/assets/previews/horror.webp +0 -0
  262. package/resources/targets/codex/js3d/js3d/context/skills/game-art-style/assets/previews/lowpoly.webp +0 -0
  263. package/resources/targets/codex/js3d/js3d/context/skills/game-art-style/assets/previews/paper.webp +0 -0
  264. package/resources/targets/codex/js3d/js3d/context/skills/game-art-style/assets/previews/voxel.webp +0 -0
  265. package/resources/targets/comate/js3d/js3d/context/skills/game-art-style/assets/previews/cartoon.webp +0 -0
  266. package/resources/targets/comate/js3d/js3d/context/skills/game-art-style/assets/previews/comic.webp +0 -0
  267. package/resources/targets/comate/js3d/js3d/context/skills/game-art-style/assets/previews/cozy.webp +0 -0
  268. package/resources/targets/comate/js3d/js3d/context/skills/game-art-style/assets/previews/cyber.webp +0 -0
  269. package/resources/targets/comate/js3d/js3d/context/skills/game-art-style/assets/previews/horror.webp +0 -0
  270. package/resources/targets/comate/js3d/js3d/context/skills/game-art-style/assets/previews/lowpoly.webp +0 -0
  271. package/resources/targets/comate/js3d/js3d/context/skills/game-art-style/assets/previews/paper.webp +0 -0
  272. package/resources/targets/comate/js3d/js3d/context/skills/game-art-style/assets/previews/voxel.webp +0 -0
  273. package/resources/targets/cursor/js3d/js3d/context/skills/game-art-style/assets/previews/cartoon.webp +0 -0
  274. package/resources/targets/cursor/js3d/js3d/context/skills/game-art-style/assets/previews/comic.webp +0 -0
  275. package/resources/targets/cursor/js3d/js3d/context/skills/game-art-style/assets/previews/cozy.webp +0 -0
  276. package/resources/targets/cursor/js3d/js3d/context/skills/game-art-style/assets/previews/cyber.webp +0 -0
  277. package/resources/targets/cursor/js3d/js3d/context/skills/game-art-style/assets/previews/horror.webp +0 -0
  278. package/resources/targets/cursor/js3d/js3d/context/skills/game-art-style/assets/previews/lowpoly.webp +0 -0
  279. package/resources/targets/cursor/js3d/js3d/context/skills/game-art-style/assets/previews/paper.webp +0 -0
  280. package/resources/targets/cursor/js3d/js3d/context/skills/game-art-style/assets/previews/voxel.webp +0 -0
  281. package/resources/targets/dsh/js3d/js3d/context/skills/game-art-style/assets/previews/cartoon.webp +0 -0
  282. package/resources/targets/dsh/js3d/js3d/context/skills/game-art-style/assets/previews/comic.webp +0 -0
  283. package/resources/targets/dsh/js3d/js3d/context/skills/game-art-style/assets/previews/cozy.webp +0 -0
  284. package/resources/targets/dsh/js3d/js3d/context/skills/game-art-style/assets/previews/cyber.webp +0 -0
  285. package/resources/targets/dsh/js3d/js3d/context/skills/game-art-style/assets/previews/horror.webp +0 -0
  286. package/resources/targets/dsh/js3d/js3d/context/skills/game-art-style/assets/previews/lowpoly.webp +0 -0
  287. package/resources/targets/dsh/js3d/js3d/context/skills/game-art-style/assets/previews/paper.webp +0 -0
  288. package/resources/targets/dsh/js3d/js3d/context/skills/game-art-style/assets/previews/voxel.webp +0 -0
  289. package/resources/targets/kimi/js3d/js3d/context/skills/game-art-style/assets/previews/cartoon.webp +0 -0
  290. package/resources/targets/kimi/js3d/js3d/context/skills/game-art-style/assets/previews/comic.webp +0 -0
  291. package/resources/targets/kimi/js3d/js3d/context/skills/game-art-style/assets/previews/cozy.webp +0 -0
  292. package/resources/targets/kimi/js3d/js3d/context/skills/game-art-style/assets/previews/cyber.webp +0 -0
  293. package/resources/targets/kimi/js3d/js3d/context/skills/game-art-style/assets/previews/horror.webp +0 -0
  294. package/resources/targets/kimi/js3d/js3d/context/skills/game-art-style/assets/previews/lowpoly.webp +0 -0
  295. package/resources/targets/kimi/js3d/js3d/context/skills/game-art-style/assets/previews/paper.webp +0 -0
  296. package/resources/targets/kimi/js3d/js3d/context/skills/game-art-style/assets/previews/voxel.webp +0 -0
  297. package/resources/targets/opencode/js3d/js3d/context/skills/game-art-style/assets/previews/cartoon.webp +0 -0
  298. package/resources/targets/opencode/js3d/js3d/context/skills/game-art-style/assets/previews/comic.webp +0 -0
  299. package/resources/targets/opencode/js3d/js3d/context/skills/game-art-style/assets/previews/cozy.webp +0 -0
  300. package/resources/targets/opencode/js3d/js3d/context/skills/game-art-style/assets/previews/cyber.webp +0 -0
  301. package/resources/targets/opencode/js3d/js3d/context/skills/game-art-style/assets/previews/horror.webp +0 -0
  302. package/resources/targets/opencode/js3d/js3d/context/skills/game-art-style/assets/previews/lowpoly.webp +0 -0
  303. package/resources/targets/opencode/js3d/js3d/context/skills/game-art-style/assets/previews/paper.webp +0 -0
  304. package/resources/targets/opencode/js3d/js3d/context/skills/game-art-style/assets/previews/voxel.webp +0 -0
  305. package/resources/targets/qoder/js3d/js3d/context/skills/game-art-style/assets/previews/cartoon.webp +0 -0
  306. package/resources/targets/qoder/js3d/js3d/context/skills/game-art-style/assets/previews/comic.webp +0 -0
  307. package/resources/targets/qoder/js3d/js3d/context/skills/game-art-style/assets/previews/cozy.webp +0 -0
  308. package/resources/targets/qoder/js3d/js3d/context/skills/game-art-style/assets/previews/cyber.webp +0 -0
  309. package/resources/targets/qoder/js3d/js3d/context/skills/game-art-style/assets/previews/horror.webp +0 -0
  310. package/resources/targets/qoder/js3d/js3d/context/skills/game-art-style/assets/previews/lowpoly.webp +0 -0
  311. package/resources/targets/qoder/js3d/js3d/context/skills/game-art-style/assets/previews/paper.webp +0 -0
  312. package/resources/targets/qoder/js3d/js3d/context/skills/game-art-style/assets/previews/voxel.webp +0 -0
  313. package/resources/targets/qoder-cn/js3d/js3d/context/skills/game-art-style/assets/previews/cartoon.webp +0 -0
  314. package/resources/targets/qoder-cn/js3d/js3d/context/skills/game-art-style/assets/previews/comic.webp +0 -0
  315. package/resources/targets/qoder-cn/js3d/js3d/context/skills/game-art-style/assets/previews/cozy.webp +0 -0
  316. package/resources/targets/qoder-cn/js3d/js3d/context/skills/game-art-style/assets/previews/cyber.webp +0 -0
  317. package/resources/targets/qoder-cn/js3d/js3d/context/skills/game-art-style/assets/previews/horror.webp +0 -0
  318. package/resources/targets/qoder-cn/js3d/js3d/context/skills/game-art-style/assets/previews/lowpoly.webp +0 -0
  319. package/resources/targets/qoder-cn/js3d/js3d/context/skills/game-art-style/assets/previews/paper.webp +0 -0
  320. package/resources/targets/qoder-cn/js3d/js3d/context/skills/game-art-style/assets/previews/voxel.webp +0 -0
  321. package/resources/targets/qwen/js3d/js3d/context/skills/game-art-style/assets/previews/cartoon.webp +0 -0
  322. package/resources/targets/qwen/js3d/js3d/context/skills/game-art-style/assets/previews/comic.webp +0 -0
  323. package/resources/targets/qwen/js3d/js3d/context/skills/game-art-style/assets/previews/cozy.webp +0 -0
  324. package/resources/targets/qwen/js3d/js3d/context/skills/game-art-style/assets/previews/cyber.webp +0 -0
  325. package/resources/targets/qwen/js3d/js3d/context/skills/game-art-style/assets/previews/horror.webp +0 -0
  326. package/resources/targets/qwen/js3d/js3d/context/skills/game-art-style/assets/previews/lowpoly.webp +0 -0
  327. package/resources/targets/qwen/js3d/js3d/context/skills/game-art-style/assets/previews/paper.webp +0 -0
  328. package/resources/targets/qwen/js3d/js3d/context/skills/game-art-style/assets/previews/voxel.webp +0 -0
  329. package/resources/targets/trae/js3d/js3d/context/skills/game-art-style/assets/previews/cartoon.webp +0 -0
  330. package/resources/targets/trae/js3d/js3d/context/skills/game-art-style/assets/previews/comic.webp +0 -0
  331. package/resources/targets/trae/js3d/js3d/context/skills/game-art-style/assets/previews/cozy.webp +0 -0
  332. package/resources/targets/trae/js3d/js3d/context/skills/game-art-style/assets/previews/cyber.webp +0 -0
  333. package/resources/targets/trae/js3d/js3d/context/skills/game-art-style/assets/previews/horror.webp +0 -0
  334. package/resources/targets/trae/js3d/js3d/context/skills/game-art-style/assets/previews/lowpoly.webp +0 -0
  335. package/resources/targets/trae/js3d/js3d/context/skills/game-art-style/assets/previews/paper.webp +0 -0
  336. package/resources/targets/trae/js3d/js3d/context/skills/game-art-style/assets/previews/voxel.webp +0 -0
  337. package/resources/targets/workbuddy/js3d/js3d/context/skills/game-art-style/assets/previews/cartoon.webp +0 -0
  338. package/resources/targets/workbuddy/js3d/js3d/context/skills/game-art-style/assets/previews/comic.webp +0 -0
  339. package/resources/targets/workbuddy/js3d/js3d/context/skills/game-art-style/assets/previews/cozy.webp +0 -0
  340. package/resources/targets/workbuddy/js3d/js3d/context/skills/game-art-style/assets/previews/cyber.webp +0 -0
  341. package/resources/targets/workbuddy/js3d/js3d/context/skills/game-art-style/assets/previews/horror.webp +0 -0
  342. package/resources/targets/workbuddy/js3d/js3d/context/skills/game-art-style/assets/previews/lowpoly.webp +0 -0
  343. package/resources/targets/workbuddy/js3d/js3d/context/skills/game-art-style/assets/previews/paper.webp +0 -0
  344. package/resources/targets/workbuddy/js3d/js3d/context/skills/game-art-style/assets/previews/voxel.webp +0 -0
  345. package/resources/targets/zcode/js3d/js3d/context/skills/game-art-style/assets/previews/cartoon.webp +0 -0
  346. package/resources/targets/zcode/js3d/js3d/context/skills/game-art-style/assets/previews/comic.webp +0 -0
  347. package/resources/targets/zcode/js3d/js3d/context/skills/game-art-style/assets/previews/cozy.webp +0 -0
  348. package/resources/targets/zcode/js3d/js3d/context/skills/game-art-style/assets/previews/cyber.webp +0 -0
  349. package/resources/targets/zcode/js3d/js3d/context/skills/game-art-style/assets/previews/horror.webp +0 -0
  350. package/resources/targets/zcode/js3d/js3d/context/skills/game-art-style/assets/previews/lowpoly.webp +0 -0
  351. package/resources/targets/zcode/js3d/js3d/context/skills/game-art-style/assets/previews/paper.webp +0 -0
  352. package/resources/targets/zcode/js3d/js3d/context/skills/game-art-style/assets/previews/voxel.webp +0 -0
  353. /package/resources/{targets/claude/js3d/js3d/context/skills/game-art-style/assets/previews/cartoon.webp → shared-art-previews/cartoon-3f9e1acaf11be3a7ffdaac90802f591a9563724e742cc5891284ef1ee8b67ee9.webp} +0 -0
  354. /package/resources/{targets/claude/js3d/js3d/context/skills/game-art-style/assets/previews/comic.webp → shared-art-previews/comic-77969cf47f2600424b5c64ef20930ba7b7081df3a5640608855913bbb99cea63.webp} +0 -0
  355. /package/resources/{targets/claude/js3d/js3d/context/skills/game-art-style/assets/previews/cozy.webp → shared-art-previews/cozy-e5fcba518afcf147c289b58b94a3532b30d96ab48418cc95efc1f28e9f80a90c.webp} +0 -0
  356. /package/resources/{targets/claude/js3d/js3d/context/skills/game-art-style/assets/previews/cyber.webp → shared-art-previews/cyber-8e6934fed1a42ed08838ac8bfaaf8f1d9b10c29c23c5843895c0791412ad3d2b.webp} +0 -0
  357. /package/resources/{targets/claude/js3d/js3d/context/skills/game-art-style/assets/previews/horror.webp → shared-art-previews/horror-041ee4c51839b38a71517a4608d94fa64b860cd9d8500e5c6fa983bd00a0e7c7.webp} +0 -0
  358. /package/resources/{targets/claude/js3d/js3d/context/skills/game-art-style/assets/previews/lowpoly.webp → shared-art-previews/lowpoly-206f350338c6c1a890981e2e35ee9bc600951701d01f2e823a259c5b5c241a08.webp} +0 -0
  359. /package/resources/{targets/claude/js3d/js3d/context/skills/game-art-style/assets/previews/paper.webp → shared-art-previews/paper-98dff3c4d5d493730af33e38777721c8a6c46c222e8f4d9f3b3c6f0f36fe19d1.webp} +0 -0
  360. /package/resources/{targets/claude/js3d/js3d/context/skills/game-art-style/assets/previews/voxel.webp → shared-art-previews/voxel-2bbe76b02f1f69059ab676eb6e2f89d0a25dd405dcab80acfc2d96f4e483098d.webp} +0 -0
@@ -9,7 +9,7 @@ import { hosts, clientIde, projectSkillPath, hostRecoveryEntry } from '../integr
9
9
  const start = '<!-- craft-mcp:project:start -->';
10
10
  const end = '<!-- craft-mcp:project:end -->';
11
11
  // Independent of engine bundle versions: generated recovery instructions evolve too.
12
- export const entryPolicyVersion = 13;
12
+ export const entryPolicyVersion = 14;
13
13
  const hash = value => createHash('sha256').update(value).digest('hex');
14
14
  const turnUpdateGuide = '进入 Craft 工作流后,每条用户消息使用新的检查 key。同一轮调用支持 `update_request_key` 的业务工具时传这个 key,工具会顺带检查;本轮仅答疑、编辑本地文件或只用轮询等工具时,补一次只读 `craft_update_check`(request_key=本轮 key,已有工程传 name)。制作时,业务回执的 update_notice 或显式检查返回 update_available=true 且 automatic_update_enabled=true,就用同一 key 调用 `craft_update`(mode=auto,已有工程传 name)。纯查看只检查,未发现更新直接继续。同一目标版本待重连时只提示一次。';
15
15
  const normalizeLines = value => value.replace(/\r\n/g,'\n');
@@ -118,12 +118,12 @@ function recoveryEntries(name, engine, ide = 'generic', isolated = false) {
118
118
  const label = engine === 'js3d' ? '3D / Three.js' : '2D / Phaser';
119
119
  const desiredSkill = `---\nname: craft-project\ndescription: 恢复、修改、验收或预览当前 Craft ${label} 游戏 ${name},通过 Craft MCP 上传游戏、更新云端版本或发布游戏。Resume or upload this existing Craft game.\n---\n\n`
120
120
  + start + '\n# 继续当前 Craft 游戏\n\n'
121
- + '首次接手先读根 AGENTS.md 的接入流程,确认当前宿主及项目安装信息;缺失 MCP 时先检查、按需安装并核验当前会话连接,再调用下面的工具。不要因延迟工具尚未发现而误判未安装。\n\n'
121
+ + '首次接手先读根 AGENTS.md 的接入流程,确认当前宿主及项目安装信息;缺失 Craft MCP 时先检查、按需安装并核验当前会话连接,再调用下面的工具。不要因延迟工具尚未发现而误判未安装。\n\n'
122
122
  + (isolated ? '本入口适用于 '+host+',project-setup 使用 `--ide '+host+'`;当前 Agent 不属于该宿主时按根路由读取自身入口。\n\n' : '')
123
123
  + `1. 读取项目根 \`AGENTS.md\`,确认工程 \`${name}\` 和引擎 \`${engine}\`。\n`
124
124
  + turnUpdateGuide + '\n\n'
125
125
  + (isolated ? '2. 当前连接仍持有本工程有效 work 时沿用 work_id/context_revision。新会话先调用只读 `craft_game_info` 核对项目和工作区。核对实际版本后,尚无有效 work 且可继续时调用 `craft_game_prepare`(mode=resume,同一 request_key)。轮询完成并保留 work_id/context_revision,重新读取本 Skill 相邻的 [引擎入口](../../AGENTS.md)、[恢复说明](../../recovery.md)、[工作流](../../workflow.md) 和 [技能索引](../index.json),按任务读取当前宿主 skills/ 下的正文。\n' : '2. 按根 AGENTS.md 查询 `craft_game_info`,读取返回的引擎入口、工作流与技能索引。\n')
126
- + (isolated ? ' 新版安装后等待下次 MCP 启动或用户重连。确认实际 version、build_id、active_verified 后,prepare(resume) 更新当前宿主、原引擎的上下文和 Skill,再重新读取正文。\n' : '')
126
+ + (isolated ? ' 新版安装后等待下次 MCP 启动或用户重连。确认实际 version、build_id、active_verified 后,prepare(resume) 按游戏原引擎更新各已绑定宿主有变化的官方 Skill。完成后重新读取本宿主的索引和正文。\n' : '')
127
127
  + (isolated ? ' 不主动重载或中断工作;按 connection_handoff 提示用户,先保存进度并 release。只重试明确未开始的 prepare,不重放结果不明的操作。\n' : '')
128
128
  + '3. ' + uploadGuide + (isolated ? ' 按本宿主[上传与发布说明](../../knowledge/Publishing.md)执行。' : '') + '\n'
129
129
  + '4. 纯查看只读现有文件,不 prepare。制作工具带 work_id;需要验收玩法或交付本地预览时再看图、启动预览。等待后台任务结束后调用 craft_game_release(name,work_id)。重试准备复用原 request_key,下一轮制作使用新 key;resume 不安装依赖或重建模板。\n'
@@ -8,7 +8,7 @@ import { assetConfig, safeProjectFile } from './asset-import.mjs';
8
8
  import { engineDefinition } from './engines.mjs';
9
9
  import { prepareProjectContext, projectContextPaths } from './project-context.mjs';
10
10
  import { clientIde } from '../integrations/hosts.mjs';
11
- import { ProjectBundles, readContextLock, contextBinding, checkProjectCompatibility } from './project-bundles.mjs';
11
+ import { ProjectBundles, readContextLock, contextBinding, checkProjectCompatibility, planContextRelease, assertContextRelease } from './project-bundles.mjs';
12
12
  import { contextLayoutSchema, inspectNativeContext, nativeContextPath, nativeSelection } from './native-context.mjs';
13
13
  import { inspectContextState, beginContextPreparation, finishContextPreparation } from './context-state.mjs';
14
14
  import { readProjectInstall, planProjectInstall, ensureProjectInstall, projectInstallFile } from './project-install.mjs';
@@ -86,11 +86,9 @@ export class Projects {
86
86
  try {lock=await readContextLock(project,engine);} catch(error) {invalid=error.message;}
87
87
  const binding=invalid ? {status:'invalid',reason:invalid} : contextBinding(lock,this.ide,engine);
88
88
  const entry=lock?.contexts?.[this.ide];
89
- let version_status='unknown';
90
- if(entry) {
91
- const difference=(entry.version??'').split('.').map((n,i)=>Number(n)-Number(installed.bundle.version?.split('.')[i])).find(n=>n!==0)??0;
92
- version_status=entry.bundle_id===installed.bundle.id ? 'matches_installed' : difference>0 ? 'requires_newer_runtime' : difference<0 ? 'update_available' : 'unknown';
93
- }
89
+ let release;
90
+ if(installed.host && !invalid) try {release=await planContextRelease(installed.legacyResources,installed.bundle,lock,full ? project : undefined);} catch(error) {invalid=error.message;}
91
+ const version_status=release?.version_status??'unknown';
94
92
  const layoutSchema=lock?.schema===4 ? 4 : contextLayoutSchema;
95
93
  const native=installed.host ? await inspectNativeContext(project,this.ide,engine,{full,schema:layoutSchema}) : {integrity:'unchecked'};
96
94
  let incompatible;
@@ -103,7 +101,7 @@ export class Projects {
103
101
  if(invalid) preparation={status:'blocked',reason:invalid};
104
102
  else if(incompatible) preparation={status:'blocked',reason:incompatible};
105
103
  else if(installation.status==='blocked') preparation={status:'blocked',reason:installation.reason};
106
- else if(version_status==='requires_newer_runtime') preparation={status:'blocked',reason:'Connect a newer Craft runtime; context cannot be downgraded'};
104
+ else if(version_status==='requires_newer_runtime') preparation={status:'blocked',reason:'Connect a compatible Craft runtime; context cannot be downgraded for '+release.conflicting_hosts.join(', ')};
107
105
  else if(lock?.schema===4 && !['blocked','recovery_required'].includes(state.status)) preparation={status:'migration_required',reason:'context_layout_migration_required',from_schema:4,to_schema:contextLayoutSchema};
108
106
  else if(!['recovery_required','blocked'].includes(state.status) && (version_status!=='matches_installed' || native.integrity==='invalid' || native.integrity==='modified' || (installed.host && lock?.active_hosts?.[nativeContextPath(this.ide)]!==this.ide) || !record)) preparation={status:'required',reason:!record ? 'registration_required' : 'Prepare installed context and recovery entries before editing'};
109
107
  else if(installation.changed && !['recovery_required','blocked'].includes(state.status)) preparation={status:'required',reason:'Project installation information needs preparation'};
@@ -111,7 +109,7 @@ export class Projects {
111
109
  if(!invalid) try {if(JSON.stringify(await readContextLock(project,engine))!==JSON.stringify(lock)) preparation={status:'updating',reason:'Context commit changed during inspection; query again'};} catch {preparation={status:'updating',reason:'Context commit changed during inspection; query again'};}
112
110
  return {name,project,engine,registration_required:!record,context_binding:binding,
113
111
  project_install:{file:projectInstallFile,status:installation.status,...(installation.manifest?{manifest:installation.manifest}:{}),...(installation.reason?{reason:installation.reason}:{})},
114
- version_status,integrity:{status:native.integrity,...(native.reason ? {reason:native.reason} : {})},preparation,
112
+ version_status,...(release?{pending_hosts:release.pending_hosts,conflicting_hosts:release.conflicting_hosts}:{}),integrity:{status:native.integrity,...(native.reason ? {reason:native.reason} : {})},preparation,
115
113
  project_context:{...projectContextPaths(project,this.ide,layoutSchema),...(state.discovery?.skills?.[this.ide] ? {discovery:{native_status:state.discovery.native_status,...state.discovery.skills[this.ide]}} : {})},
116
114
  ...(installed.host ? {context_layout:{schema:lock?.schema??null,target_schema:contextLayoutSchema,status:lock?.schema===4?'migration_required':lock?.schema===contextLayoutSchema?'current':'unbound',directory:nativeContextPath(this.ide,layoutSchema),target_directory:nativeContextPath(this.ide)},
117
115
  context:{...nativeSelection(project,installed,{schema:layoutSchema}).context,target:{host:this.ide,engine,version:entry?.version,bundle_id:entry?.bundle_id}}} : {})};
@@ -165,11 +163,15 @@ export class Projects {
165
163
  const ready=await inspectContextState(project,lock,{full:true});
166
164
  if(ready.status==='blocked') throw new Error(ready.reason);
167
165
  let selected;
168
- if(ready.status==='ready' && !installation.changed) {try {selected=await this.bundles.resolve(project,engine,lock);} catch { /* Explicit prepare repairs or reports the precise compatibility error below. */ }}
169
- if(selected) sync={lock,selected,context_revision:ready.context_revision,project_context:{...projectContextPaths(project,this.ide),...(ready.discovery?.skills?.[this.ide] ? {discovery:{native_status:ready.discovery.native_status,...ready.discovery.skills[this.ide]}} : {})},sync:{policy:'follow-installed',location:'project',status:'current',version:selected.bundle.version,bundle_id:selected.bundle.id,directory:selected.resources}};
166
+ if(ready.status==='ready' && !installation.changed) {
167
+ const source=this.engines[engine];
168
+ const release=await planContextRelease(source.legacyResources,source.bundle,lock,project);
169
+ assertContextRelease(release);
170
+ if(release.version_status==='matches_installed') {try {selected=await this.bundles.resolve(project,engine,lock);} catch { /* Explicit prepare repairs or reports the precise compatibility error below. */ }}
171
+ }
172
+ if(selected) sync={lock,selected,context_revision:ready.context_revision,project_context:{...projectContextPaths(project,this.ide),...(ready.discovery?.skills?.[this.ide] ? {discovery:{native_status:ready.discovery.native_status,...ready.discovery.skills[this.ide]}} : {})},sync:{policy:'follow-installed',location:'project',status:'current',updated_hosts:[],version:selected.bundle.version,bundle_id:selected.bundle.id,directory:selected.resources}};
170
173
  else {
171
- await beginContextPreparation(project,this.ide);
172
- sync=await this.bundles.synchronize(project,engine,{...options,allowAttach:true,guard,finalize:async (lock,verifyPublished)=>{
174
+ sync=await this.bundles.synchronize(project,engine,{...options,allowAttach:true,guard,begin:()=>beginContextPreparation(project,this.ide),finalize:async (lock,verifyPublished)=>{
173
175
  await guard();
174
176
  await saveInstallation();
175
177
  const project_context=await prepareProjectContext(project,name,engine,this.ide,true,guard);
@@ -211,7 +213,7 @@ export async function fingerprint(project) {
211
213
  if (skip.has(entry.name)) continue;
212
214
  const file = path.join(dir,entry.name), key = relative + '/' + entry.name;
213
215
  // Version history is not a game input. The active sync record below is fingerprinted.
214
- if (['/.craft/contexts','/.craft/context-backups'].includes(key)) continue;
216
+ if (['/.craft/contexts','/.craft/context-backups','/.craft/art-previews'].includes(key)) continue;
215
217
  if (entry.isSymbolicLink()) throw new Error('Source symbolic links are not supported: ' + key);
216
218
  if (entry.isDirectory()) { await walk(file,key); continue; }
217
219
  if (!entry.isFile()) throw new Error('Unsupported source file: ' + key);
@@ -40,7 +40,9 @@ export async function commitFiles(changes) {
40
40
  const backup = change.file + '.craft-backup-' + randomUUID();
41
41
  await writeFile(backup, change.before, { flag: 'wx', mode: 0o600 }); backups.push(backup);
42
42
  }
43
- await replace(change.file, change.after); committed.push(change);
43
+ if (change.after === null) await unlink(change.file);
44
+ else await replace(change.file, change.after);
45
+ committed.push(change);
44
46
  }
45
47
  } catch (error) {
46
48
  for (const change of committed.reverse()) {
@@ -0,0 +1,44 @@
1
+ import path from 'node:path';
2
+ import { optionalFile } from './files.mjs';
3
+ import { registryOrigin, updateSource } from './installation-state.mjs';
4
+ import { compareVersions, requireForwardVersion } from './version-policy.mjs';
5
+
6
+ // npm exec can record the original package spec on its own cache entry. Never
7
+ // infer a channel from a resolved version, a cwd manifest or the npm default tag.
8
+ export async function npmInstallSelector(packageRoot, name, env = process.env) {
9
+ if (env.npm_command !== 'exec' || env.npm_lifecycle_event !== 'npx') return null;
10
+ const cache = path.resolve(packageRoot, ...name.split('/').map(() => '..'), '..');
11
+ if (path.basename(path.dirname(cache)) !== '_npx' ||
12
+ path.relative(cache, packageRoot) !== path.join('node_modules', ...name.split('/'))) return null;
13
+ const metadata = await optionalFile(path.join(cache, 'package.json'));
14
+ let specs;
15
+ try { specs = metadata && JSON.parse(metadata)._npx?.packages; }
16
+ catch (error) { if (error instanceof SyntaxError) return null; throw error; }
17
+ if (!Array.isArray(specs) || specs.length !== 1 || typeof specs[0] !== 'string') return null;
18
+ if (specs[0] === name) return { kind: 'bare' };
19
+ if (!specs[0].startsWith(name + '@')) return { kind: 'package' };
20
+ const tag = specs[0].slice(name.length + 1);
21
+ const isTag = /^[a-zA-Z][a-zA-Z0-9._-]*$/.test(tag) && !/^(?:v\d+(?:\.|$)|x(?:\.|$))/i.test(tag);
22
+ return isTag ? { kind: 'tag', tag } : { kind: 'package' };
23
+ }
24
+
25
+ export function installSource(pkg, { registry, channel, selector }, state, legacy) {
26
+ const previous = state?.source ?? legacy;
27
+ const source = updateSource(pkg, { registry: registry ?? previous?.registry, channel: channel ?? previous?.channel }, state?.source);
28
+ const switching = Boolean(channel && previous?.channel && channel !== previous.channel);
29
+ // A pinned version or local archive remains the payload on a normal install.
30
+ // A bare/management reinstall instead resolves the user's existing channel.
31
+ const followTag = Boolean(channel && previous?.channel) || selector === 'tag' ||
32
+ (['bare', 'management'].includes(selector) && Boolean(channel || previous?.channel));
33
+ return { source, followTag, allowLower: switching && registryOrigin(previous.registry) === source.registry };
34
+ }
35
+
36
+ export function checkInstallVersion(identity, plan, integrity) {
37
+ const previous = plan.previousRuntime;
38
+ if (previous && previous.version === identity.version && previous.origin?.kind === 'npm' &&
39
+ previous.origin.registry === plan.source.registry && integrity && previous.origin.integrity !== integrity) {
40
+ throw new Error('Craft same-version registry integrity changed; installation refused');
41
+ }
42
+ if (plan.allowLower && previous && compareVersions(identity.version, previous.version) < 0) return;
43
+ requireForwardVersion(identity, previous);
44
+ }
@@ -7,9 +7,10 @@ import { hostPaths, hostCommandOptions, installTargets } from './hosts.mjs';
7
7
  import { craftConfig, craftRegistrations, mergeConfig, importZcodeFallback } from './config.mjs';
8
8
  import { assertDshSharedScope } from './dsh-config.mjs';
9
9
  import { optionalFile, assertPlainPath, commitFiles } from './files.mjs';
10
- import { stageRuntime, probeRuntime, getRuntimeIdentity } from './runtime.mjs';
11
- import { installationPath, readInstallation, readInstallationSnapshot, registryOrigin, updateSource, installedSkillEntries, skillRuntimeIdentity, sameRuntimeIdentity, activationMode } from './installation-state.mjs';
12
- import { requireForwardVersion } from './version-policy.mjs';
10
+ import { stageRuntime, stageRegistryRuntime, probeRuntime, getRuntimeIdentity } from './runtime.mjs';
11
+ import { installationPath, readInstallation, readInstallationSnapshot, registryOrigin, installedSkillEntries, skillRuntimeIdentity, sameRuntimeIdentity, activationMode } from './installation-state.mjs';
12
+ import { queryRegistry } from './updates.mjs';
13
+ import { npmInstallSelector, installSource, checkInstallVersion } from './install-source.mjs';
13
14
  import { connectionHandoff } from './connection-handoff.mjs';
14
15
  import { planLauncher, verifyLauncher } from './fixed-launcher.mjs';
15
16
  import { prepareRuntimeCandidate, refreshRuntimeCandidate, publishRuntimeCandidate, disposeRuntimeCandidate } from './runtime-candidate.mjs';
@@ -56,7 +57,8 @@ function hostRuntimeEnvironment(host, existing = {}) {
56
57
 
57
58
  export async function installHosts({ ide, workspace, platform, packageRoot, home = os.homedir(), codexHome, hostOptions = {},
58
59
  runtimeRoot = path.join(getAppDataRoot(), 'runtimes'), stateRoot = path.join(path.dirname(runtimeRoot), 'installations'),
59
- registry, channel, updates, onlyIfMissing = false, materialize = stageRuntime, probe = probeRuntime }) {
60
+ registry, channel, updates, selector = 'package', onlyIfMissing = false, materialize = stageRuntime, probe = probeRuntime,
61
+ lookup = queryRegistry, materializeRegistry = stageRegistryRuntime }) {
60
62
  const targets = installTargets(ide);
61
63
  if (hostOptions.configPath && targets.length !== 1) throw new Error('--host-config requires exactly one --ide');
62
64
  if (workspace !== undefined && !path.isAbsolute(workspace)) throw new Error('--workspace must be absolute');
@@ -64,10 +66,6 @@ export async function installHosts({ ide, workspace, platform, packageRoot, home
64
66
  if (registry != null) registry = registryOrigin(registry);
65
67
  if (updates !== undefined && !['auto', 'off'].includes(updates)) throw new Error('--updates must be auto or off');
66
68
  const pkg = JSON.parse(await readFile(path.join(packageRoot, 'package.json'), 'utf8'));
67
- const desiredSkill = await readFile(path.join(packageRoot, 'resources/craft-create/SKILL.md'), 'utf8');
68
- const desiredUpdateSkill = await optionalFile(path.join(packageRoot, 'resources/craft-update/SKILL.md'));
69
- if (!desiredSkill.includes(bootstrapMarker)) throw new Error('Craft bootstrap Skill missing from distribution');
70
- if (desiredUpdateSkill !== null && !desiredUpdateSkill.includes('<!-- craft-mcp:update:v1 -->')) throw new Error('Craft update Skill has an invalid distribution marker');
71
69
  await mkdir(runtimeRoot, { recursive: true });
72
70
  const targetPaths = new Map(targets.map(host => [host, hostPaths(home, host, codexHome, hostOptions)]));
73
71
  async function readPlans() {
@@ -87,7 +85,6 @@ export async function installHosts({ ide, workspace, platform, packageRoot, home
87
85
  }
88
86
  const existingUpdateSkill = await optionalFile(paths.updateSkill);
89
87
  if (existingSkill && !existingSkill.includes(bootstrapMarker)) throw new Error('User-owned craft-create Skill preserved; rename it before installing: ' + paths.skill);
90
- if (desiredUpdateSkill && existingUpdateSkill && !existingUpdateSkill.includes('<!-- craft-mcp:update:v1 -->')) throw new Error('User-owned craft-update Skill preserved; rename it before installing: ' + paths.updateSkill);
91
88
  const registrations = craftRegistrations(configInput, host);
92
89
  if (onlyIfMissing && registrations.length) throw new Error(host + ': Craft was configured while project setup was running; preserve the registration and inspect it again');
93
90
  if (registrations.length > 1) throw new Error(host + ': Multiple Craft registrations found; preserve separate environments and select one installation before updating');
@@ -112,7 +109,11 @@ export async function installHosts({ ide, workspace, platform, packageRoot, home
112
109
  const games = workspace ?? (workspaceIndex >= 0 ? old.args[workspaceIndex + 1] : old?.env?.CLIENT_WORKSPACE_ROOT) ?? path.join(home, 'CraftGames');
113
110
  if (!path.isAbsolute(games)) throw new Error('Configured Craft workspace must be absolute');
114
111
  const origin = platformOrigin(platform ?? old?.env?.CRAFT_WEB_URL ?? pkg.craft?.platform);
115
- plans.push({ host, paths, original, configInput, fallbackSnapshot, existingSkill, existingUpdateSkill, previousName, previousRuntime, previousState, legacySource, statePath, stateBefore, workspace: path.resolve(games), platform: origin });
112
+ const selection = installSource(pkg, { registry, channel, selector }, previousState, legacySource);
113
+ plans.push({ host, paths, original, configInput, fallbackSnapshot, existingSkill, existingUpdateSkill, previousName, previousRuntime, previousState, legacySource, statePath, stateBefore, workspace: path.resolve(games), platform: origin, ...selection });
114
+ }
115
+ if (channel && plans.some(plan => plan.followTag)) {
116
+ for (const plan of plans) plan.followTag = true;
116
117
  }
117
118
  return plans;
118
119
  }
@@ -144,16 +145,56 @@ export async function installHosts({ ide, workspace, platform, packageRoot, home
144
145
  }
145
146
  }
146
147
  const initialPlans = await readPlans();
147
- const candidate = await prepareRuntimeCandidate(runtimeRoot, staging => materialize(packageRoot, staging, { registry }));
148
+ const candidates = new Map(), releases = new Map();
149
+ async function preparePlan(plan) {
150
+ let remote;
151
+ if (plan.followTag) {
152
+ const key = JSON.stringify(plan.source);
153
+ if (!releases.has(key)) releases.set(key, await lookup(plan.source));
154
+ remote = releases.get(key);
155
+ if (remote.package !== pkg.name || !remote.integrity) throw new Error('Invalid Craft channel package or integrity');
156
+ checkInstallVersion({ version: remote.version }, plan, remote.integrity);
157
+ }
158
+ const key = remote ? JSON.stringify([remote.version, remote.integrity]) : 'package';
159
+ if (!candidates.has(key)) {
160
+ const candidate = await prepareRuntimeCandidate(runtimeRoot, staging => remote
161
+ ? materializeRegistry(plan.source, remote, staging)
162
+ : materialize(packageRoot, staging, { registry }));
163
+ candidates.set(key, candidate);
164
+ const resources = path.join(candidate.identity.package_root, 'resources');
165
+ candidate.createSkill = await readFile(path.join(resources,'craft-create/SKILL.md'),'utf8');
166
+ candidate.updateSkill = await optionalFile(path.join(resources,'craft-update/SKILL.md'));
167
+ if (!candidate.createSkill.includes(bootstrapMarker)) throw new Error('Craft bootstrap Skill missing from distribution');
168
+ if (candidate.updateSkill !== null && !candidate.updateSkill.includes('<!-- craft-mcp:update:v1 -->')) throw new Error('Craft update Skill has an invalid distribution marker');
169
+ }
170
+ const candidate = candidates.get(key);
171
+ if (candidate.identity.package !== pkg.name || (remote && candidate.identity.version !== remote.version)) throw new Error('Craft channel package does not match the resolved release');
172
+ const managedUpdateSkill = plan.previousState?.skills?.['craft-update'] === plan.paths.updateSkill;
173
+ plan.writeUpdateSkill = candidate.updateSkill !== null || managedUpdateSkill;
174
+ if (plan.writeUpdateSkill && plan.existingUpdateSkill !== null && !plan.existingUpdateSkill.includes('<!-- craft-mcp:update:v1 -->')) throw new Error('User-owned craft-update Skill preserved; rename it before installing: ' + plan.paths.updateSkill);
175
+ plan.candidate = candidate;
176
+ plan.integrity = remote?.integrity;
177
+ }
148
178
  const verifiedCache = new Map();
149
179
  try {
150
180
  for (let attempt = 0; attempt < 4; attempt++) {
151
181
  let plans, stateLocks = [], release;
182
+ const movedCandidates = new Set();
152
183
  try {
153
184
  plans = attempt === 0 ? initialPlans : await readPlans();
154
185
  const verifiedByHost = new Map();
155
186
  for (const plan of plans) {
156
- requireForwardVersion(candidate.identity, plan.previousRuntime);
187
+ if (attempt > 0) {
188
+ const original = initialPlans.find(initial => initial.host === plan.host);
189
+ const before = original.previousState?.source ?? original.legacySource ?? original.source;
190
+ const after = plan.previousState?.source ?? plan.legacySource;
191
+ if (after?.channel && (after.channel !== before.channel || (before.registry && before.registry !== after.registry))) {
192
+ throw new Error('Craft installation channel or registry changed during install; retry using its current binding');
193
+ }
194
+ }
195
+ await preparePlan(plan);
196
+ const candidate = plan.candidate;
197
+ checkInstallVersion(candidate.identity, plan, plan.integrity);
157
198
  const old = craftConfig(plan.configInput, plan.host, plan.previousName);
158
199
  const connection = { ...old, command: process.execPath, args: [candidate.identity.entry, '--workspace', plan.workspace],
159
200
  env: { ...old?.env, ...hostRuntimeEnvironment(plan.host,old?.env), CRAFT_CLIENT_IDE: plan.host, CRAFT_WEB_URL: plan.platform, CLIENT_WORKSPACE_ROOT: plan.workspace,
@@ -165,8 +206,10 @@ export async function installHosts({ ide, workspace, platform, packageRoot, home
165
206
  verifiedCache.set(key, verified);
166
207
  verifiedByHost.set(plan.host, verified);
167
208
  }
168
- if (!sameRuntimeIdentity(await getRuntimeIdentity(candidate.identity.package_root), candidate.identity)) throw new Error('Craft candidate changed during verification; installation refused');
169
- await refreshRuntimeCandidate(candidate);
209
+ for (const candidate of new Set(plans.map(plan => plan.candidate))) {
210
+ if (!sameRuntimeIdentity(await getRuntimeIdentity(candidate.identity.package_root), candidate.identity)) throw new Error('Craft candidate changed during verification; installation refused');
211
+ await refreshRuntimeCandidate(candidate);
212
+ }
170
213
  const lockPaths = [...new Set(plans.flatMap(plan => [plan.statePath.file, craftConfig(plan.configInput, plan.host, plan.previousName)?.env?.CRAFT_INSTALLATION_FILE].filter(Boolean)).map(file => path.resolve(file)))].sort();
171
214
  for (const file of lockPaths) {
172
215
  await assertPlainPath(file); await mkdir(path.dirname(file), { recursive: true });
@@ -175,12 +218,21 @@ export async function installHosts({ ide, workspace, platform, packageRoot, home
175
218
  // Never hold installation-state locks while waiting on launcher or GC.
176
219
  release = await lockfile.lock(runtimeRoot, { stale: 120000, retries: 0 });
177
220
  await verifyPlans(plans);
178
- const runtime = await publishRuntimeCandidate(candidate);
179
- const identity = { package: runtime.package, version: runtime.version, build_id: runtime.build_id, package_root: runtime.package_root, entry: runtime.entry };
180
- const changes = [], results = [];
221
+ const published = new Map(), changes = [], results = [];
181
222
  for (const plan of plans) {
182
- requireForwardVersion(identity, plan.previousRuntime);
183
- const source = updateSource(pkg, { registry: registry ?? (!plan.previousState ? plan.legacySource?.registry : undefined), channel: channel ?? (!plan.previousState ? plan.legacySource?.channel : undefined) }, plan.previousState?.source);
223
+ const { candidate, source } = plan;
224
+ const destination = candidate.destination ?? candidate.identity.package_root;
225
+ if (!published.has(destination)) {
226
+ published.set(destination, await publishRuntimeCandidate(candidate));
227
+ if (candidate.managed && !candidate.existing) movedCandidates.add(candidate);
228
+ }
229
+ const runtime = published.get(destination);
230
+ const identity = skillRuntimeIdentity(runtime);
231
+ checkInstallVersion(identity, plan, plan.integrity);
232
+ const origin = plan.integrity ? { kind:'npm', registry:source.registry, integrity:plan.integrity }
233
+ : identity.build_id === plan.previousRuntime?.build_id && plan.previousRuntime.origin?.registry === source.registry ? plan.previousRuntime.origin : undefined;
234
+ const target = origin ? { ...identity, origin } : identity;
235
+ const { createSkill: desiredSkill, updateSkill: desiredUpdateSkill } = candidate;
184
236
  const migration = plan.previousState?.migration ?? (plan.legacySource ? { from_server: plan.previousName, ...plan.legacySource } : undefined);
185
237
  const launcherPlan = await planLauncher(plan.statePath.file, plan.previousState?.launcher, identity.package_root);
186
238
  const loginDir = plan.host === 'workbuddy' && process.platform === 'win32'
@@ -194,7 +246,7 @@ export async function installHosts({ ide, workspace, platform, packageRoot, home
194
246
  ...(plan.paths.configPeers?{config_peers:plan.paths.configPeers}:{}),
195
247
  ...(migration ? { migration } : {}),
196
248
  skills: { 'craft-create': plan.paths.skill, ...(desiredUpdateSkill ? { 'craft-update': plan.paths.updateSkill } : {}) },
197
- policy: { mode: updates ?? plan.previousState?.policy.mode ?? 'auto', offline: 'allow-existing' }, anchor: identity, target: identity, skills_runtime: skillRuntimeIdentity(identity) };
249
+ policy: { mode: updates ?? plan.previousState?.policy.mode ?? 'auto', offline: 'allow-existing' }, anchor: identity, target, skills_runtime: skillRuntimeIdentity(identity) };
198
250
  if (plan.previousState?.connection_verification && sameRuntimeIdentity(identity, plan.previousState.target) && plan.workspace === plan.previousState.workspace && plan.platform === plan.previousState.platform) state.connection_verification = plan.previousState.connection_verification;
199
251
  // Reinstalling the same build must not reset check receipts or touch files.
200
252
  const priorComparable = plan.previousState && { ...plan.previousState };
@@ -211,7 +263,7 @@ export async function installHosts({ ide, workspace, platform, packageRoot, home
211
263
  const updated = mergeConfig(plan.configInput, plan.host, connection, { previousName: plan.previousName, enable: !alreadyEnabled });
212
264
  const verified = verifiedByHost.get(plan.host);
213
265
  changes.push({ file: plan.paths.skill, before: plan.existingSkill, after: desiredSkill });
214
- if (desiredUpdateSkill) changes.push({ file: plan.paths.updateSkill, before: plan.existingUpdateSkill, after: desiredUpdateSkill });
266
+ if (plan.writeUpdateSkill) changes.push({ file: plan.paths.updateSkill, before: plan.existingUpdateSkill, after: desiredUpdateSkill });
215
267
  // A host may react as soon as its config changes. Make the state and
216
268
  // managed entrypoints available before exposing the new launch command.
217
269
  changes.push(launcherPlan.change, { file: plan.statePath.file, before: plan.stateBefore, after: same ? plan.stateBefore : JSON.stringify(desiredState, null, 2) + '\n' },
@@ -221,16 +273,22 @@ export async function installHosts({ ide, workspace, platform, packageRoot, home
221
273
  connection_handoff: connectionHandoff({host:plan.host,target:identity,workspace:plan.workspace,platform:plan.platform,intent:'install'}) });
222
274
  }
223
275
  const written = await commitFiles(changes);
224
- return { runtime, hosts: results, ...written,
276
+ return { ...(published.size === 1 ? {runtime:published.values().next().value} : {runtimes:[...published.values()]}), hosts: results, ...written,
225
277
  next: 'The installed package loads at the next MCP start or user-requested reconnect. Verify the actual runtime version/build_id, then prepare the current project to update its context and Skills. Standalone probes do not confirm host activation.' };
226
278
  } catch (error) {
227
279
  if (!['ELOCKED', 'INSTALLATION_CHANGED'].includes(error.code) || attempt === 3) throw error;
228
280
  } finally {
229
281
  try { await release?.(); } finally { for (const unlock of stateLocks.reverse()) await unlock(); }
230
282
  }
283
+ // A different target in a multi-host install may have raced after this
284
+ // candidate was moved. Re-stage its private copy before the next probe.
285
+ for (const [key, candidate] of candidates) if (movedCandidates.has(candidate)) {
286
+ await disposeRuntimeCandidate(candidate);
287
+ candidates.delete(key);
288
+ }
231
289
  await new Promise(resolve => setTimeout(resolve, 100 * (attempt + 1)));
232
290
  }
233
- } finally { await disposeRuntimeCandidate(candidate); }
291
+ } finally { await Promise.all([...candidates.values()].map(disposeRuntimeCandidate)); }
234
292
  }
235
293
 
236
294
  async function verifyInstalledSkills(installation, paths, connection, snapshot) {
@@ -364,6 +422,12 @@ export async function runIntegrationCommand(args, packageRoot) {
364
422
  }
365
423
  options.codexHome = process.env.CODEX_HOME;
366
424
  options.hostOptions = hostCommandOptions(options);
425
+ if (command === 'install') {
426
+ const { name } = JSON.parse(await readFile(path.join(packageRoot,'package.json'),'utf8'));
427
+ const request = await npmInstallSelector(packageRoot, name);
428
+ options.selector = request?.kind ?? 'management';
429
+ options.channel ??= request?.tag;
430
+ }
367
431
  const result = command === 'install' ? await installWithLoginTask({ ...options, packageRoot }) : await doctorHosts(options);
368
432
  process.stdout.write(JSON.stringify(result, null, 2) + '\n');
369
433
  }
@@ -10,7 +10,7 @@ import { compareVersions } from './version-policy.mjs';
10
10
  import { readInstallation, registryOrigin } from './installation-state.mjs';
11
11
  import { hostReloadProfile } from './host-reload.mjs';
12
12
  import { readProjectInstall } from '../game-workflow/project-install.mjs';
13
- import { readContextLock, checkProjectCompatibility } from '../game-workflow/project-bundles.mjs';
13
+ import { readContextLock, checkProjectCompatibility, planContextRelease } from '../game-workflow/project-bundles.mjs';
14
14
  import { safeProjectFile } from '../game-workflow/asset-import.mjs';
15
15
  import { engineDefinition } from '../game-workflow/engines.mjs';
16
16
  import { verifyBundle } from '../game-workflow/bundle-files.mjs';
@@ -160,9 +160,11 @@ export async function setupProject({ project, ide, packageRoot, install = false,
160
160
  if (bundle.host !== ide) throw new Error('Installer context belongs to another host');
161
161
  await checkProjectCompatibility(project, bundle);
162
162
  if (lock?.compatibility && !isDeepStrictEqual(lock.compatibility, bundle.compatibility)) throw new Error('Installer engine compatibility differs from the project binding');
163
- const bound = lock?.contexts?.[ide];
164
- if (bound && (compareVersions(bundle.version, bound.version) < 0 || (bundle.version === bound.version && bundle.id !== bound.bundle_id))) return { ...response, status: 'installer_update_required',
165
- bootstrap: bootstrapCommand(project, ide, manifest, paths, hostOptions), next: 'This package cannot preserve the project host context binding. Select a newer compatible Craft release; context downgrade or same-version replacement is refused.' };
163
+ if (lock?.contexts) {
164
+ const plan=await planContextRelease(path.join(packageRoot,'resources'),bundle,lock);
165
+ if (plan.conflicting_hosts.length) return { ...response, status: 'installer_update_required', conflicting_hosts:plan.conflicting_hosts,
166
+ bootstrap: bootstrapCommand(project, ide, manifest, paths, hostOptions), next: 'This package cannot preserve the project host context bindings. Select a newer compatible Craft release; context downgrade or same-version replacement is refused.' };
167
+ }
166
168
  if (!install) return { ...response, status: 'missing_installation',
167
169
  next: 'No Craft registration exists for this host. Repeat this command with --install to install only this host using the project platform, source and actual parent directory. Host trust and connection must still be verified.' };
168
170
  if (!isDeepStrictEqual(await readProjectInstall(project, { required: true }), manifest)) throw new Error('Project installation metadata changed during setup; retry');
@@ -27,6 +27,15 @@ function result(state, current, status, extra = {}) {
27
27
  activation_required: false, reconnect_required: !sameRuntimeIdentity(current, state.target), explicitly_not_started: true, ...extra };
28
28
  }
29
29
 
30
+ // A still-running MCP may have been launched from a different channel. Only
31
+ // compare package versions once it is operating on its own installed channel.
32
+ export function pendingChannelSwitch(state, current, connectedSource) {
33
+ if (connectedSource?.package === state.source.package && connectedSource.registry === state.source.registry &&
34
+ connectedSource.channel !== state.source.channel && compareVersions(state.target.version, current.version) !== 0) {
35
+ return result(state, current, 'pending_reconnect', { can_continue: false });
36
+ }
37
+ }
38
+
30
39
  export async function readUpdateStatus({ installationFile, current }) {
31
40
  if (!installationFile) return { status: 'unmanaged', current, activation_required: false, note: 'Run the standard Craft installer once to enable automatic updates.' };
32
41
  try {
@@ -136,9 +145,11 @@ async function hostUpdate(state, installationFile, launcher, identity) {
136
145
  return { file: state.config, before, after: mergeConfig(before, state.host, connection, { previousName: state.server_id, enable: false }) };
137
146
  }
138
147
 
139
- async function checkSnapshot({ installationFile, current, intent, requestKey, projectCompatibility, registryReceipt, lookup, materialize, probe }) {
148
+ async function checkSnapshot({ installationFile, current, connectedSource, intent, requestKey, projectCompatibility, registryReceipt, lookup, materialize, probe }) {
140
149
  let state = (await readInstallationSnapshot(installationFile)).state;
141
150
  if (current.package !== state.source.package) return result(state, current, 'error', { code: 'package_mismatch', can_continue: false });
151
+ const switched = pendingChannelSwitch(state, current, connectedSource);
152
+ if (switched) return switched;
142
153
  try { requireForwardVersion(state.target, current); }
143
154
  catch (error) { return result(state, current, 'error', { code: 'target_not_forward', message: error.message, can_continue: false }); }
144
155
  let pendingIncompatible;
@@ -276,17 +287,17 @@ async function checkSnapshot({ installationFile, current, intent, requestKey, pr
276
287
  finally { if (candidate) await disposeRuntimeCandidate(candidate); }
277
288
  }
278
289
 
279
- export async function checkForUpdate({ installationFile, current, intent = 'inspect', requestKey, projectCompatibility, registryReceipt, lookup = queryRegistry, materialize = stageRegistryRuntime, probe = probeRuntime }) {
290
+ export async function checkForUpdate({ installationFile, current, connectedSource, intent = 'inspect', requestKey, projectCompatibility, registryReceipt, lookup = queryRegistry, materialize = stageRegistryRuntime, probe = probeRuntime }) {
280
291
  if (!installationFile) return { status: 'unmanaged', current, can_continue: true, activation_required: false, note: 'Install Craft once to enable automatic updates.' };
281
292
  if (!['inspect', 'auto', 'create', 'resume', 'update'].includes(intent)) throw new Error('Invalid update intent');
282
293
  // Deduplicate only the same logical request. Other readers and downloads
283
294
  // proceed independently; the short commit compares their installation snapshot.
284
- const key = requestKey ? JSON.stringify([installationFile, current.build_id, current.instance_id, intent, requestKey]) : Symbol('unkeyed update');
295
+ const key = requestKey ? JSON.stringify([installationFile, current.build_id, current.instance_id, connectedSource?.channel, intent, requestKey]) : Symbol('unkeyed update');
285
296
  if (pending.has(key)) return pending.get(key);
286
297
  const operation = (async () => {
287
298
  for (let attempt = 0; attempt < 3; attempt++) {
288
299
  try {
289
- return await checkSnapshot({ installationFile, current, intent, requestKey, projectCompatibility, registryReceipt, lookup, materialize, probe });
300
+ return await checkSnapshot({ installationFile, current, connectedSource, intent, requestKey, projectCompatibility, registryReceipt, lookup, materialize, probe });
290
301
  } catch (error) {
291
302
  if (error.code === 'INSTALLATION_CHANGED' && attempt < 2) continue;
292
303
  if (['ELOCKED', 'INSTALLATION_CHANGED'].includes(error.code)) return installationBusy(error, current);
@@ -87,7 +87,7 @@ function runtimeBusy({excludeUpdate=false}={}) {
87
87
  }
88
88
  const updates=new UpdateSession({installationFile:process.env.CRAFT_INSTALLATION_FILE,current:runtimeIdentity,projects,host,workspace:root,platform:platform.base,busy:runtimeBusy});
89
89
  let runtimeConnection;
90
- if(process.env.CRAFT_INSTALLATION_FILE && !await updates.scopeError()) {
90
+ if(process.env.CRAFT_INSTALLATION_FILE && !await updates.connectionIssue()) {
91
91
  try { runtimeConnection=await registerRuntimeConnection({installationFile:process.env.CRAFT_INSTALLATION_FILE,current:runtimeIdentity}); }
92
92
  catch { process.stderr.write('[craft] Runtime cleanup is unavailable for this connection; MCP remains active.\n'); }
93
93
  }
@@ -148,7 +148,7 @@ const tools = [
148
148
  // The connection and prepare result use the same maintained workflow; clients may omit initialize instructions from their model context.
149
149
  const server = new Server({ name:'craft-local',version },{ capabilities:{ tools:{} },instructions:guide });
150
150
  function productionTelemetry() {
151
- // The SDK has recorded clientInfo by the time the client calls a tool.
151
+ // Initialization supplies clientInfo for hosts identified by handshake name.
152
152
  return telemetry ??= new ProductionTelemetry(platform,drafts,mcpProduceLocation(host,{
153
153
  configuredHost:configuredMcpHost, clientName:server.getClientVersion()?.name
154
154
  }),{ state,workspace:root,version });
@@ -159,6 +159,7 @@ server.oninitialized=()=>{
159
159
  // Hosts also initialize short-lived discovery probes. They can close or kill
160
160
  // the child immediately after tools/list, so readiness must never start GC.
161
161
  connectionReady=updates.connected();
162
+ if (process.env.CRAFT_STANDALONE_PROBE !== '1') productionTelemetry().start();
162
163
  };
163
164
  server.setRequestHandler(ListToolsRequestSchema,async()=>({ tools }));
164
165
  function viewTask(task) {
@@ -237,7 +238,6 @@ server.setRequestHandler(CallToolRequestSchema,async request=>{
237
238
  }
238
239
  businessResult = await withWork(work,work ? ()=>validateWork(work,{preparing:preparing || definition.name==='craft_task_cancel'}) : undefined,async()=>{
239
240
  const production = productionTelemetry();
240
- if (definition.name !== 'craft_auth_logout' && process.env.CRAFT_STANDALONE_PROBE !== '1') production.start();
241
241
  let result;
242
242
  switch (definition.name) {
243
243
  case 'craft_update_check': result=await updates.inspect(args); break;
@@ -258,7 +258,8 @@ server.setRequestHandler(CallToolRequestSchema,async request=>{
258
258
  const updateStatus=await updates.status();
259
259
  result = { version, runtime:{...runtimeIdentity,busy:runtimeBusy(),activation:updateStatus.activation??{status:updateStatus.status}},update:updateStatus,host,mcp_produce_location:production.location, workspace:root, workspace_layout:'<workspace>/<name>', platform:platform.base, engine:effectiveEngine ?? null, supported_engines:Object.keys(engines),
260
260
  context_binding:project?.context_binding,project_install:project?.project_install,
261
- version_status:project?.version_status,integrity:project?.integrity,preparation:project?.preparation,registration_required:project?.registration_required,occupancy,project_context:project?.project_context,
261
+ version_status:project?.version_status,pending_hosts:project?.pending_hosts,conflicting_hosts:project?.conflicting_hosts,
262
+ integrity:project?.integrity,preparation:project?.preparation,registration_required:project?.registration_required,occupancy,project_context:project?.project_context,
262
263
  project:project?.project, preview:project ? await previews.status(project.project) : undefined,
263
264
  llm:'external AI IDE host',draft_upload:true,publish_in_web:true,
264
265
  concurrency:{workspace_sessions:'multiple',project_works:1,readonly_queries:'unlocked',release:'craft_game_release(name, work_id); abnormal process exit expires within 30 seconds'},
@@ -3,8 +3,9 @@ import { randomUUID } from 'node:crypto';
3
3
  import { readFile } from 'node:fs/promises';
4
4
  import { isDeepStrictEqual } from 'node:util';
5
5
  import { loadEngineResources } from '../game-workflow/engines.mjs';
6
- import { readContextLock, checkProjectCompatibility } from '../game-workflow/project-bundles.mjs';
7
- import { checkForUpdate, readUpdateStatus, readInstallation, confirmActiveInstallation, queryRegistry } from '../integrations/updates.mjs';
6
+ import { readContextLock, checkProjectCompatibility, planContextRelease, assertContextRelease } from '../game-workflow/project-bundles.mjs';
7
+ import { checkForUpdate, readUpdateStatus, readInstallation, confirmActiveInstallation, pendingChannelSwitch, queryRegistry } from '../integrations/updates.mjs';
8
+ import { sameRuntimeIdentity } from '../integrations/installation-state.mjs';
8
9
  import { connectionHandoff } from '../integrations/connection-handoff.mjs';
9
10
  import { readProjectInstall, assertProjectInstallConnection } from '../game-workflow/project-install.mjs';
10
11
 
@@ -38,17 +39,28 @@ export class UpdateSession {
38
39
  // roll back before the process acknowledges a graceful shutdown.
39
40
  await Promise.allSettled([...this.updates,...this.inspections]);
40
41
  }
41
- async scopeError() {
42
+ async connectionIssue(handoff) {
42
43
  if(!this.installationFile) return null;
43
44
  try {
44
45
  const state=await readInstallation(this.installationFile);
45
46
  const normalize=value=>{const resolved=path.resolve(value);return process.platform==='win32'?resolved.toLowerCase():resolved;};
46
47
  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');
48
+ const switched=pendingChannelSwitch(state,this.current,this.connectedSource);
49
+ if(switched) return this.withHandoff(switched,handoff);
50
+ // Remember the source only when this process actually matches the target.
51
+ // Two tags can point to the same build; that process can keep serving.
52
+ if(sameRuntimeIdentity(this.current,state.target)) {
53
+ if(this.connectedSource && !isDeepStrictEqual(this.connectedSource,state.source)) {
54
+ delete this.last;
55
+ this.receipts.clear();
56
+ }
57
+ this.connectedSource=state.source;
58
+ }
47
59
  return null;
48
60
  } catch(error) {return {status:'error',code:'installation_scope_mismatch',message:error.message,current:this.current,can_continue:false,activation_required:false};}
49
61
  }
50
62
  async status() {
51
- const error=await this.scopeError();if(error) return error;
63
+ const issue=await this.connectionIssue();if(issue) return issue;
52
64
  const verification=this.verificationStatus();if(verification) return verification;
53
65
  return this.withHandoff({...await readUpdateStatus({installationFile:this.installationFile,current:this.current}),
54
66
  ...(this.last ? {last_check:this.last} : {})},{intent:'inspect'});
@@ -103,7 +115,13 @@ export class UpdateSession {
103
115
  async confirmConnection() {
104
116
  try {
105
117
  if(!this.installationFile) {this.clearConnectionRetry();delete this.connectionError;return {status:'unmanaged'};}
106
- const error=await this.scopeError();if(error) {this.clearConnectionRetry();return this.connectionError=error;}
118
+ const issue=await this.connectionIssue({excludeUpdate:true});
119
+ if(issue) {
120
+ this.clearConnectionRetry();
121
+ if(issue.status==='error') this.connectionError=issue;
122
+ else delete this.connectionError;
123
+ return issue;
124
+ }
107
125
  const status=await readUpdateStatus({installationFile:this.installationFile,current:this.current});
108
126
  if(status.status==='error') {this.clearConnectionRetry();return this.connectionError=status;}
109
127
  if(status.activation?.status!=='active_verified') {
@@ -148,7 +166,7 @@ export class UpdateSession {
148
166
  return this.check({name,request_key,intent:mode==='manual'?'update':'auto'});
149
167
  }
150
168
  async checkCurrent({name,intent='inspect',request_key,advisory=false}={}) {
151
- const error=await this.scopeError();if(error) return error;
169
+ const issue=await this.connectionIssue({intent,name,request_key,excludeUpdate:intent!=='inspect'});if(issue) return issue;
152
170
  const verification=this.verificationStatus();if(verification) return verification;
153
171
  if(name!==undefined) this.projects.file(name);
154
172
  if(intent==='resume' && !name) throw new Error('Project name is required when checking a resume');
@@ -185,13 +203,9 @@ export class UpdateSession {
185
203
  await checkProjectCompatibility(project.project,candidate.bundle);
186
204
  const lock=await readContextLock(project.project,project.engine);
187
205
  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');
188
- const previous=lock?.contexts?.[this.host];
189
- if(previous && previous.bundle_id!==candidate.bundle.id) {
190
- const difference=candidate.bundle.version.split('.').map((value,i)=>Number(value)-Number(previous.version?.split('.')[i])).find(value=>value!==0)??0;
191
- if(!Number.isFinite(difference)||difference<=0) throw new Error('Candidate context is older or has a conflicting version for this project');
192
- }
206
+ if(lock?.contexts && candidate.host) assertContextRelease(await planContextRelease(candidate.legacyResources,candidate.bundle,lock));
193
207
  } : undefined;
194
- const result=await this.checkInstallation({installationFile:this.installationFile,current:this.current,intent,
208
+ const result=await this.checkInstallation({installationFile:this.installationFile,current:this.current,connectedSource:this.connectedSource,intent,
195
209
  ...(advisory && {lookup:source=>queryRegistry(source,{timeoutMs:1500})}),
196
210
  requestKey:request_key ? `${intent==='create'?'create':`${name??'global'}:${intent}`}:${request_key}` : undefined,projectCompatibility,
197
211
  registryReceipt:request_key ? this.receipts.get(request_key) : undefined});