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

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 (43) hide show
  1. package/README.md +6 -17
  2. package/bin/craft-mcp.mjs +30 -2
  3. package/dist-server/core/upload-limits.mjs +11 -0
  4. package/dist-server/game-workflow/bundle-files.mjs +6 -1
  5. package/dist-server/game-workflow/engines.mjs +18 -9
  6. package/dist-server/game-workflow/project-context.mjs +11 -7
  7. package/dist-server/game-workflow/project-install.mjs +17 -8
  8. package/dist-server/game-workflow/projects.mjs +13 -3
  9. package/dist-server/integrations/config.mjs +41 -18
  10. package/dist-server/integrations/connect.mjs +18 -9
  11. package/dist-server/integrations/connection-handoff.mjs +9 -8
  12. package/dist-server/integrations/distribution-targets.mjs +9 -0
  13. package/dist-server/integrations/dsh-config.mjs +30 -14
  14. package/dist-server/integrations/fixed-launcher.mjs +1 -0
  15. package/dist-server/integrations/host-config-scope.mjs +4 -3
  16. package/dist-server/integrations/hosts.mjs +3 -1
  17. package/dist-server/integrations/install.mjs +147 -43
  18. package/dist-server/integrations/installation-state.mjs +2 -1
  19. package/dist-server/integrations/instance-skill.mjs +26 -0
  20. package/dist-server/integrations/instance.mjs +29 -0
  21. package/dist-server/integrations/launcher-start.mjs +6 -6
  22. package/dist-server/integrations/login-task-command.mjs +3 -3
  23. package/dist-server/integrations/opencode-config.mjs +13 -6
  24. package/dist-server/integrations/project-setup.mjs +48 -18
  25. package/dist-server/integrations/runtime-candidate.mjs +32 -6
  26. package/dist-server/integrations/runtime-file-diagnostics.mjs +68 -0
  27. package/dist-server/integrations/runtime-gc.mjs +8 -2
  28. package/dist-server/integrations/runtime-identity.mjs +56 -8
  29. package/dist-server/integrations/runtime.mjs +7 -3
  30. package/dist-server/integrations/uninstall.mjs +160 -0
  31. package/dist-server/integrations/updates.mjs +57 -42
  32. package/dist-server/launcher.mjs +65 -10
  33. package/dist-server/mcp/production-events.mjs +52 -29
  34. package/dist-server/mcp/server.mjs +18 -9
  35. package/dist-server/mcp/update-session.mjs +9 -6
  36. package/dist-server/preview/preview-snapshot.mjs +3 -2
  37. package/package.json +5 -3
  38. package/resources/craft-create/SKILL.md +2 -0
  39. package/resources/craft-update/SKILL.md +2 -0
  40. package/vendor/craft-runtime/NOTICE.md +1 -1
  41. package/vendor/craft-runtime/SOURCE.json +9 -5
  42. package/vendor/craft-runtime/index.js +228 -164
  43. package/vendor/craft-runtime/package.json +1 -1
@@ -6,6 +6,7 @@ import { atomicJson, privateDirectory } from '../game-workflow/request-store.mjs
6
6
  import { validMcpProduceLocation } from '../core/production-source.mjs';
7
7
 
8
8
  const retentionMs = 24 * 60 * 60 * 1000;
9
+ const maxDeliveryAttempts = 3;
9
10
  const uuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
10
11
 
11
12
  export class ProductionEvents {
@@ -127,48 +128,69 @@ export class ProductionEvents {
127
128
  return context.project_id;
128
129
  }
129
130
 
131
+ async #readEvent(file) {
132
+ if (!uuid.test(file.slice(0,-5)) || !file.endsWith('.json')) return;
133
+ const target = path.join(this.directory,file);
134
+ const stat = await lstat(target);
135
+ if (!stat.isFile() || stat.isSymbolicLink() || stat.size > 8192) return;
136
+ const event = JSON.parse(await readFile(target,'utf8'));
137
+ if (!this.#valid(event,file)) return;
138
+ if (Date.now() - Date.parse(event.occurred_at) >= retentionMs ||
139
+ (event.delivery_attempts ?? 0) >= maxDeliveryAttempts) {
140
+ await unlink(target);
141
+ return;
142
+ }
143
+ return {target,event};
144
+ }
145
+
130
146
  async #readEvents() {
131
147
  const entries = [];
132
148
  for (const file of await readdir(this.directory)) {
133
- if (!uuid.test(file.slice(0,-5)) || !file.endsWith('.json')) continue;
134
- const target = path.join(this.directory,file);
135
149
  try {
136
- const stat = await lstat(target);
137
- if (!stat.isFile() || stat.isSymbolicLink() || stat.size > 8192) continue;
138
- const event = JSON.parse(await readFile(target,'utf8'));
139
- if (!this.#valid(event,file)) continue;
140
- if (Date.now() - Date.parse(event.occurred_at) >= retentionMs) await unlink(target);
141
- else entries.push({target,event});
150
+ const entry = await this.#readEvent(file);
151
+ if (entry) entries.push(entry);
142
152
  } catch { /* Another connection may have delivered this record. */ }
143
153
  }
144
154
  return entries;
145
155
  }
146
156
 
147
- async #flush() {
148
- // Resolve all bindings under a local lock before network IO. Upload completion
149
- // can pin pending events without waiting for delivery or a subsequent upload.
150
- const pending = await this.#exclusive(async () => {
151
- const ready = [];
152
- for (const {target,event} of await this.#readEvents()) {
153
- const session = this.platform.store.getSession();
154
- if (!session.loggedIn || Number(session.identity?.userId) !== event.owner ||
155
- event.platform !== this.platform.base || event.workspace !== this.workspace) continue;
156
- if (!event.project_id) {
157
- event.project_id = await this.#projectID(event);
158
- if (!event.project_id) continue;
159
- await atomicJson(target,event);
160
- }
161
- ready.push({target,event});
157
+ async #claim(target) {
158
+ return this.#exclusive(async () => {
159
+ if (this.#shutdown.signal.aborted) return;
160
+ const current = await this.#readEvent(path.basename(target));
161
+ if (!current) return;
162
+ const { delivery_attempts = 0,...event } = current.event;
163
+ const session = this.platform.store.getSession();
164
+ if (!session.loggedIn || Number(session.identity?.userId) !== event.owner ||
165
+ event.platform !== this.platform.base || event.workspace !== this.workspace) return;
166
+ if (!event.project_id) {
167
+ event.project_id = await this.#projectID(event);
168
+ if (!event.project_id) return;
162
169
  }
163
- return ready;
170
+ // Reserve on disk before network IO so concurrent connections and restarts
171
+ // share the same budget, including an interrupted delivery with unknown outcome.
172
+ const attempts = delivery_attempts + 1;
173
+ await atomicJson(target,{...event,delivery_attempts:attempts});
174
+ return {event,attempts};
164
175
  });
165
- for (const {target,event} of pending) {
176
+ }
177
+
178
+ async #flush() {
179
+ const pending = await this.#exclusive(() => this.#readEvents());
180
+ for (const {target} of pending) {
166
181
  if (this.#shutdown.signal.aborted) break;
167
182
  try {
168
- await this.platform.reportProductionEvent(event,
169
- AbortSignal.any([this.#shutdown.signal,AbortSignal.timeout(5000)]));
170
- await unlink(target);
171
- } catch { /* The same event is retried while its original account is active. */ }
183
+ const attempt = await this.#claim(target);
184
+ if (!attempt) continue;
185
+ try {
186
+ await this.platform.reportProductionEvent(attempt.event,
187
+ AbortSignal.any([this.#shutdown.signal,AbortSignal.timeout(5000)]));
188
+ } catch {
189
+ if (attempt.attempts < maxDeliveryAttempts) continue;
190
+ }
191
+ // Serialize deletion with reservations so a concurrent writer cannot restore it.
192
+ await this.#exclusive(() => unlink(target));
193
+ } catch { /* Persisted reservations keep later flushes within the delivery budget. */ }
172
194
  }
173
195
  }
174
196
 
@@ -178,6 +200,7 @@ export class ProductionEvents {
178
200
  ['js','js3d'].includes(event.engine) && Number.isSafeInteger(event.owner) && event.owner > 0 &&
179
201
  validMcpProduceLocation(event.location) && typeof event.client_version === 'string' &&
180
202
  Number.isFinite(Date.parse(event.occurred_at)) &&
203
+ (event.delivery_attempts === undefined || Number.isSafeInteger(event.delivery_attempts) && event.delivery_attempts >= 0) &&
181
204
  (event.event === 'debug' && [0,1,2,3].includes(event.debug_result) ||
182
205
  event.event === 'build' && [0,1].includes(event.build_result) && event.turn_index === 0 && event.retry_index === 0);
183
206
  }
@@ -20,19 +20,22 @@ import { getLoginPage } from './login-page.mjs';
20
20
  import { loadEngineResources, loadEngineResource } from '../game-workflow/engines.mjs';
21
21
  import { takeConnectorToken, ConnectorAuthStore, connectorLoginAction } from '../core/connector-auth.mjs';
22
22
  import { clientIde } from '../integrations/hosts.mjs';
23
+ import { validateServerId } from '../integrations/instance.mjs';
23
24
  import { currentWork, withWork, guardWork } from '../game-workflow/work-scope.mjs';
24
25
  import { mcpProduceLocation } from '../core/production-source.mjs';
25
26
  import { ProductionTelemetry } from './production-telemetry.mjs';
26
- import { getRuntimeIdentity } from '../integrations/runtime.mjs';
27
+ import { readRunningIdentity } from '../integrations/runtime-identity.mjs';
27
28
  import { UpdateSession } from './update-session.mjs';
28
29
  import { registerRuntimeConnection } from '../integrations/runtime-gc.mjs';
29
30
  import { readInstallation, sameRuntimeIdentity } from '../integrations/installation-state.mjs';
31
+ import { readProjectInstall, assertProjectInstallConnection } from '../game-workflow/project-install.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
- const { version } = JSON.parse(await readFile(new URL('../../package.json',import.meta.url),'utf8'));
35
- const runtimeIdentity={...await getRuntimeIdentity(fileURLToPath(new URL('../..',import.meta.url))),instance_id:randomUUID(),pid:process.pid,activation_mode:'next_mcp_start'};
36
+ const runningPackage = await readRunningIdentity(fileURLToPath(new URL('../..',import.meta.url)), { managed: Boolean(process.env.CRAFT_FIXED_LAUNCHER) });
37
+ const runtimeIdentity = { ...runningPackage, instance_id:randomUUID(), pid:process.pid, activation_mode:'next_mcp_start' };
38
+ const { version } = runtimeIdentity;
36
39
  await mkdir(getWorkspaceRoot(),{ recursive:true });
37
40
  const root = await realpath(getWorkspaceRoot()), state = getUserDataDir(), resources = process.env.CRAFT_MCP_RESOURCES_DIR;
38
41
  const sessionFile = path.join(state,'auth-session.json');
@@ -43,17 +46,18 @@ if (connectorAuth) {
43
46
  finally { connectorToken = undefined; }
44
47
  }
45
48
  const host = clientIde(process.env.CRAFT_CLIENT_IDE);
49
+ const serverId = validateServerId(process.env.CRAFT_SERVER_ID ?? 'craft');
46
50
  const configuredMcpHost = process.env.CRAFT_MCP_HOST;
47
- const { instructions:guide, workflow:bootstrapWorkflow, engines } = await loadEngineResources(resources,host);
51
+ const { instructions:guide, workflow:bootstrapWorkflow, engines } = await loadEngineResources(resources,host,{deferPayload:Boolean(process.env.CRAFT_FIXED_LAUNCHER)});
48
52
  const projects = new Projects(root,state,engines,host,async()=>{
49
53
  // Test/local transports are not a portable service address. Never publish a
50
54
  // loopback mock server into a project that will be opened on another machine.
51
55
  if(new URL(platform.base).protocol!=='https:') return {unavailable:'non_portable_platform'};
52
56
  const installationFile=process.env.CRAFT_INSTALLATION_FILE;
53
- if(!installationFile) return {version,platform:platform.base};
57
+ if(!installationFile) return {version,platform:platform.base,requireKnownChannel:true};
54
58
  const installation=await readInstallation(installationFile);
55
59
  const canonical=value=>process.platform==='win32'?path.resolve(value).toLowerCase():path.resolve(value);
56
- if(installation.host!==host || canonical(installation.workspace)!==canonical(root) || new URL(installation.platform).origin!==new URL(platform.base).origin || installation.source.package!==runtimeIdentity.package) {
60
+ if(installation.server_id!==serverId || installation.host!==host || canonical(installation.workspace)!==canonical(root) || new URL(installation.platform).origin!==new URL(platform.base).origin || installation.source.package!==runtimeIdentity.package) {
57
61
  throw new Error('Craft installation scope differs from this connection; reconnect before preparing project installation information');
58
62
  }
59
63
  if(!sameRuntimeIdentity(runtimeIdentity,installation.target)) throw new Error('The installed Craft target differs from this running connection; reconnect and verify the actual runtime before preparing project installation information');
@@ -76,7 +80,12 @@ let runtimeMaintenance;
76
80
  let openingLoginPages=0;
77
81
  async function validateWork(work,{preparing=false}={}) {
78
82
  await leases.assert(work.name,work.work_id,{ready:!preparing,context_revision:work.context_revision});
79
- if(!preparing) await projects.assertRevision(work.name,work.context_revision);
83
+ if(!preparing) {
84
+ const project = await projects.assertRevision(work.name,work.context_revision);
85
+ const manifest = await readProjectInstall(project.project);
86
+ if (manifest) assertProjectInstallConnection(manifest, {engine:project.engine,version,platform:platform.base,
87
+ registry:updates.connectedSource?.registry,channel:updates.connectedSource?.channel,requireKnownChannel:true});
88
+ }
80
89
  }
81
90
  function runtimeBusy({excludeUpdate=false}={}) {
82
91
  const busy={work_count:leases.activeCount,task_count:tasks.activeCount,mutation_count:mutations.size,
@@ -85,7 +94,7 @@ function runtimeBusy({excludeUpdate=false}={}) {
85
94
  maintenance_count:Number(Boolean(runtimeMaintenance))};
86
95
  return {...busy,can_reconnect:!closing && Object.values(busy).every(count=>count===0)};
87
96
  }
88
- const updates=new UpdateSession({installationFile:process.env.CRAFT_INSTALLATION_FILE,current:runtimeIdentity,projects,host,workspace:root,platform:platform.base,busy:runtimeBusy});
97
+ const updates=new UpdateSession({installationFile:process.env.CRAFT_INSTALLATION_FILE,current:runtimeIdentity,projects,host,serverId,workspace:root,platform:platform.base,busy:runtimeBusy});
89
98
  let runtimeConnection;
90
99
  if(process.env.CRAFT_INSTALLATION_FILE && !await updates.connectionIssue()) {
91
100
  try { runtimeConnection=await registerRuntimeConnection({installationFile:process.env.CRAFT_INSTALLATION_FILE,current:runtimeIdentity}); }
@@ -256,7 +265,7 @@ server.setRequestHandler(CallToolRequestSchema,async request=>{
256
265
  if(project.preparation.status==='updating') project.integrity={status:'unchecked',reason:'Context changed during inspection; query again after preparation'};
257
266
  }
258
267
  const updateStatus=await updates.status();
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),
268
+ result = { version, server_id:serverId, channel:updates.connectedSource?.channel ?? null, 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
269
  context_binding:project?.context_binding,project_install:project?.project_install,
261
270
  version_status:project?.version_status,pending_hosts:project?.pending_hosts,conflicting_hosts:project?.conflicting_hosts,
262
271
  integrity:project?.integrity,preparation:project?.preparation,registration_required:project?.registration_required,occupancy,project_context:project?.project_context,
@@ -12,9 +12,9 @@ import { readProjectInstall, assertProjectInstallConnection } from '../game-work
12
12
  // This connection owns one complete package for its entire lifetime. An
13
13
  // installer probe or another connection can never replace its runtime identity.
14
14
  export class UpdateSession {
15
- constructor({installationFile, current, projects, host, workspace, platform, busy,
15
+ constructor({installationFile, current, projects, host, workspace, platform, serverId = 'craft', busy,
16
16
  confirmInstallation=confirmActiveInstallation,checkInstallation=checkForUpdate,retryMinMs=250,retryMaxMs=5000}) {
17
- Object.assign(this,{installationFile,current,projects,host,workspace,platform,busy});
17
+ Object.assign(this,{installationFile,current,projects,host,workspace,platform,serverId,busy});
18
18
  Object.assign(this,{confirmInstallation,checkInstallation,retryMinMs,retryMaxMs});
19
19
  this.updates=new Set();
20
20
  this.inspections=new Set();
@@ -40,11 +40,14 @@ export class UpdateSession {
40
40
  await Promise.allSettled([...this.updates,...this.inspections]);
41
41
  }
42
42
  async connectionIssue(handoff) {
43
- if(!this.installationFile) return null;
43
+ if (!this.installationFile) {
44
+ if (this.serverId === 'craft') return null;
45
+ return {status:'error',code:'installation_scope_mismatch',message:'Named Craft instances require their own installation record',can_continue:false,activation_required:false};
46
+ }
44
47
  try {
45
48
  const state=await readInstallation(this.installationFile);
46
49
  const normalize=value=>{const resolved=path.resolve(value);return process.platform==='win32'?resolved.toLowerCase():resolved;};
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');
50
+ if(state.server_id!==this.serverId || 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 server, host, workspace or platform differs from this connection; run install with the intended scope and reconnect');
48
51
  const switched=pendingChannelSwitch(state,this.current,this.connectedSource);
49
52
  if(switched) return this.withHandoff(switched,handoff);
50
53
  // Remember the source only when this process actually matches the target.
@@ -68,7 +71,7 @@ export class UpdateSession {
68
71
  withHandoff(result,{intent='inspect',name,request_key,excludeUpdate=false}={}) {
69
72
  if(!result.reconnect_required || !result.target || ['error','incompatible','migration_required'].includes(result.status)) return result;
70
73
  const busy=this.busy?.({excludeUpdate});
71
- const handoff=connectionHandoff({host:this.host,target:result.target,current:this.current,workspace:this.workspace,platform:this.platform,
74
+ const handoff=connectionHandoff({host:this.host,serverId:this.serverId,channel:result.source?.channel,target:result.target,current:this.current,workspace:this.workspace,platform:this.platform,
72
75
  busy,intent,name,requestKey:request_key});
73
76
  return {...result,...(busy?{busy}:{}),connection_handoff:handoff,next:handoff.next};
74
77
  }
@@ -178,7 +181,7 @@ export class UpdateSession {
178
181
  const source=this.installationFile ? (await readInstallation(this.installationFile)).source : undefined;
179
182
  if(source && source.package!==manifest.package_name) throw new Error('Project installation package differs from the current Craft installation');
180
183
  assertProjectInstallConnection(manifest,{engine:project.engine,version,platform:this.platform,
181
- registry:source?.registry,channel:source?.channel});
184
+ registry:source?.registry,channel:source?.channel,requireKnownChannel:true});
182
185
  };
183
186
  try {
184
187
  projectInstall=project ? await readProjectInstall(project.project) : null;
@@ -2,6 +2,7 @@ import path from 'node:path';
2
2
  import { open,lstat,realpath } from 'node:fs/promises';
3
3
  import { constants } from 'node:fs';
4
4
  import { createHash } from 'node:crypto';
5
+ import { runtimeUploadLimits as limits } from '../core/upload-limits.mjs';
5
6
 
6
7
  const mime={'.html':'text/html; charset=utf-8','.js':'text/javascript','.css':'text/css','.json':'application/json',
7
8
  '.png':'image/png','.jpg':'image/jpeg','.jpeg':'image/jpeg','.svg':'image/svg+xml','.webp':'image/webp',
@@ -9,7 +10,7 @@ const mime={'.html':'text/html; charset=utf-8','.js':'text/javascript','.css':'t
9
10
  '.mp4':'video/mp4','.webm':'video/webm','.glb':'model/gltf-binary','.gltf':'model/gltf+json','.bin':'application/octet-stream','.woff2':'font/woff2'};
10
11
 
11
12
  export async function snapshotFiles(project,artifacts) {
12
- if(!path.isAbsolute(project) || !Array.isArray(artifacts) || !artifacts.length || artifacts.length>2000)throw new Error('Invalid preview artifacts');
13
+ if(!path.isAbsolute(project) || !Array.isArray(artifacts) || !artifacts.length || artifacts.length>limits.files)throw new Error('Invalid preview artifacts');
13
14
  const dist=path.join(project,'dist');
14
15
  if((await lstat(dist)).isSymbolicLink() || await realpath(dist)!==dist)throw new Error('Preview build directory changed');
15
16
  const files=new Map();let total=0;
@@ -22,7 +23,7 @@ export async function snapshotFiles(project,artifacts) {
22
23
  const handle=await open(file,constants.O_RDONLY|(constants.O_NOFOLLOW??0));let data;
23
24
  try {
24
25
  const stat=await handle.stat();
25
- if(!stat.isFile() || stat.size>8*1024*1024 || total+stat.size>64*1024*1024)throw new Error('Preview exceeds original SDK size limits');
26
+ if(!stat.isFile() || stat.size>limits.fileBytes || total+stat.size>limits.totalFileBytes)throw new Error('Preview exceeds runtime upload size limits');
26
27
  data=await handle.readFile();if(data.length!==stat.size)throw new Error('Preview file changed during collection');
27
28
  } finally {await handle.close();}
28
29
  if(createHash('sha256').update(data).digest('hex')!==artifact.sha256)throw new Error('Build output changed; run craft_game_check again');
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@craft_eco/craft-mcp",
3
- "version": "0.1.34-beta.2",
3
+ "version": "0.1.34-beta.4",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=22.12.0"
7
7
  },
8
8
  "craft": {
9
- "platform": "https://test.craft.qq.com"
9
+ "platform": "https://craft.qq.com",
10
+ "source_sha256": "e5553312c721a5039e0326c0610fad368779f1c9e1ed2e4e39de0a4d1ead09a5"
10
11
  },
11
12
  "scripts": {
12
13
  "start": "node bin/craft-mcp.mjs"
@@ -41,6 +42,7 @@
41
42
  ],
42
43
  "publishConfig": {
43
44
  "registry": "https://registry.npmjs.org/",
44
- "access": "public"
45
+ "access": "public",
46
+ "tag": "beta"
45
47
  }
46
48
  }
@@ -6,6 +6,8 @@ description: 使用 Craft 新建 2D、3D 游戏或玩法原型,上传已有本
6
6
  <!-- craft-mcp:bootstrap:v1 -->
7
7
  # 使用 Craft 创建或上传游戏
8
8
 
9
+ 本 Skill frontmatter 的 name 去掉末尾的 `-create` 或 `-update` 即为 MCP 服务名。普通请求使用默认服务 `craft`;用户明确选择了其他实例或项目已绑定其渠道时,使用对应入口。首次调用该服务的 `craft_game_info` 核对 server_id、渠道、实际版本和工作区,同次制作、轮询、上传、更新与重连沿用该服务。
10
+
9
11
  上传已有游戏、更新原云端项目或发布时,先在当前会话发现 Craft MCP 工具,调用 `craft_game_info(name)` 核对当前目录与配置的工作区。有效 Craft 工程按 `craft_game_prepare(mode="resume")` 恢复,读取该宿主引擎目录的 `knowledge/Publishing.md`。纯上传走 `craft_game_check(purpose="upload")` 和 `craft_game_upload`。当前工具未提供该检查模式时,先核对版本并按更新指引重连。普通 JS 工程不支持直接导入,报告工具给出的路径和缺项。用户指定 Craft MCP 时,工具受阻就报告具体错误;改用 Computer Use、GM 控制台或网页编辑器上传须另获用户同意。
10
12
 
11
13
  先使用当前聊天实际可用的 Craft 工具。工具未暴露时,通过宿主提供的工具发现机制定位 Craft 及准确工具名;仍在连接中则等待就绪后重试一次。仍不可用或调用失败时,报告原始错误,区分连接超时、工具未暴露和工具执行失败,停止新的准备并诊断连接;不能仅据工具缺失判断未安装或升级失败。保持用户选择的 Craft 流程,不擅自改用造化或其他游戏插件,也不混用它们的创建指南。
@@ -6,6 +6,8 @@ description: 检查或更新 Craft MCP,核对当前连接的运行版本,恢
6
6
  <!-- craft-mcp:update:v1 -->
7
7
  # 更新 Craft
8
8
 
9
+ 本 Skill frontmatter 的 name 去掉末尾的 `-create` 或 `-update` 即为 MCP 服务名。普通请求使用默认服务 `craft`;用户明确选择了其他实例或项目已绑定其渠道时,使用对应入口。首次调用该服务的 `craft_game_info` 核对 server_id、渠道、实际版本和工作区,同次制作、轮询、上传、更新与重连沿用该服务。
10
+
9
11
  先确认当前聊天能发现并调用 Craft 工具。工具未暴露时,使用宿主实际提供的工具发现机制定位准确工具名;仍在连接中则等待就绪后重试一次。仍不可用或调用失败时,保留更新目标和当前工作,报告原始错误并诊断连接,停止新的准备;不能仅据工具缺失判断未安装或升级失败。用户选择的 Craft 流程不能自行改用造化或其他游戏插件替代。
10
12
 
11
13
  进入 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)。纯查看只检查,未发现更新直接继续。同一目标版本待重连时只提示一次。新建或恢复工作时,prepare 的 request_key 使用本轮 key;该操作重试沿用原 request_key。继续已有工作沿用 work_id。新版在下次启动或用户重连后生效。手动模式仅用于用户明确要求升级。
@@ -1,3 +1,3 @@
1
1
  # Craft local runtime
2
2
 
3
- Built from the verified @tencent/craft-agentcli public API and Craft-owned local finalization source. Upstream license: MIT. Source identities and retained inputs are recorded in SOURCE.json.
3
+ Built from the verified @tencent/craft-agentcli public API and Craft-owned local finalization and upload source. Upstream license: MIT. Source identities and retained inputs are recorded in SOURCE.json.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schema": 1,
3
3
  "kind": "craft-local-runtime",
4
- "profile_version": "1.2.0",
4
+ "profile_version": "1.2.1",
5
5
  "builder": {
6
6
  "name": "esbuild",
7
7
  "version": "0.27.7"
@@ -25,7 +25,7 @@
25
25
  "commit": "48ef7264f54dd2868aca98822493f074ccea6e7b",
26
26
  "snapshot_sha256": "e2ab885cc08613dbef8631b7cd1daa0b6ca13ccfb9defb47d0cf60f7ad07e332"
27
27
  },
28
- "profile_sha256": "e1762c932e45c2b62860bf40d40521c536b550e5a6a52aa45e5e02c983669cbc",
28
+ "profile_sha256": "17080ebf7998893debd3691fd2c690b536d4fd3273c9bec4b7faa3e9bec1fe2b",
29
29
  "inputs": {
30
30
  "vendor/agent-cli/dist/src/protocol/messages/errors.gen.js": "532600441cf85d41f645ff637efce263dca2b1cd91c308d54572f33f4b7883e4",
31
31
  "vendor/agent-cli/dist/src/protocol/link/envelope.js": "5bbaeb11b3fa78494f019808d828fb9d547c60d61579daae79f6977bdff50d5e",
@@ -49,15 +49,19 @@
49
49
  "vendor/agent-cli/dist/src/context/template-refresh.js": "bead4ae074929d100e5653ac131faa23b2fa80526602663567e7e69aa0d760cd",
50
50
  "vendor/agent-cli/dist/src/context/template-sync.js": "37f7e6be88234757f73dea7c01ca94c66434207508c38a002dd5165bc5190af0",
51
51
  "sdk/finalize-game-context.mjs": "743f18b58c35e2995744f8e5fb6adff7402d6a5d290ddd4f5eb250c48af06980",
52
+ "sdk/static-artifacts.mjs": "0f6a0d1b34c095167ab427d56f5243aa6d613abbce5a0bf2208484ae00c2bbce",
53
+ "src/core/upload-limits.mjs": "4d5b473d8f80d7cb0b60ee5886f3674b5dea8c83fe510763beef08ab2b8b6896",
54
+ "sdk/external-game-archive.mjs": "9d0485c4468d51c2279755b19265f3454ea933810e69137aace93fc15ba7ce5c",
55
+ "sdk/external-game-content.mjs": "74023a2bc316f788e7739282a05575a5c8bb9b2374575eaa4bc4e8c46da72e53",
52
56
  "vendor/agent-cli/dist/src/component/isolated-launcher.js": "05a5ccf310d5d54560779396020442a7374a6bbec2a1b77231b0ba670c5cee15",
53
57
  "vendor/agent-cli/dist/src/component/proxied-fetch.js": "7d2f81d904409e9872bb4786d13d92cc9686dd94b3d81698a93593937689e15b",
54
58
  "vendor/agent-cli/dist/src/component/isolated-preload.js": "f508888d0e1c81c371227a3375be6ea658497a3f9ae5038eee48a8e041bdb734"
55
59
  },
56
60
  "files": {
57
- "index.js": "0b7409488c86c7a4df912313c115cac9c15546157ee5b7494906766d47cd46f7",
61
+ "index.js": "cdbd5f5f7b9b74bd3d13ef394b331e353782e21ad98aa3e4ebcbf1b29af8571a",
58
62
  "isolated-launcher.js": "e29f878445a81ab5b3c2855c4a1741f78992a42bb95b2cddc8a18e5bb9634584",
59
63
  "isolated-preload.js": "7fd2caa820191e5c0dc188db71d500e2854650198795fd088e90a2438326d625",
60
- "NOTICE.md": "b0211e04bc1e6a5d54976ca72fb50b462eb2aae581e11f4992ab511fccfb9afe",
61
- "package.json": "de47a8df9940bb87a45ca833aa9d2f1df120b9c34dcb6d788a47d48fed169835"
64
+ "NOTICE.md": "720b23be4a7fbc6d87899700b68e5219d59eb50a0f285b25d2fc45d4fbb0d3f4",
65
+ "package.json": "0582a79a96a035894e80ab05ba78a0eb863c3e59403080a0d1a1507d2ed64f50"
62
66
  }
63
67
  }