@craft_eco/craft-mcp 0.1.29 → 0.1.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -55
- package/bin/craft-mcp.mjs +4 -1
- package/dist-server/game-workflow/check.mjs +3 -2
- package/dist-server/game-workflow/context-state.mjs +67 -67
- package/dist-server/game-workflow/draft-archive.mjs +147 -2
- package/dist-server/game-workflow/draft-upload-identity.mjs +11 -0
- package/dist-server/game-workflow/draft-uploads.mjs +105 -60
- package/dist-server/game-workflow/local-context.mjs +62 -62
- package/dist-server/game-workflow/native-context.mjs +289 -289
- package/dist-server/game-workflow/project-bundles.mjs +246 -246
- package/dist-server/game-workflow/project-context.mjs +8 -8
- package/dist-server/game-workflow/projects.mjs +6 -4
- package/dist-server/game-workflow/tasks.mjs +1 -1
- package/dist-server/game-workflow/work-scope.mjs +7 -7
- package/dist-server/integrations/config.mjs +145 -145
- package/dist-server/integrations/connect.mjs +36 -0
- package/dist-server/integrations/connection-handoff.mjs +36 -42
- package/dist-server/integrations/dsh-config.mjs +182 -182
- package/dist-server/integrations/files.mjs +54 -54
- package/dist-server/integrations/fixed-launcher.mjs +31 -0
- package/dist-server/integrations/host-reload.mjs +19 -0
- package/dist-server/integrations/hosts.mjs +55 -55
- package/dist-server/integrations/install.mjs +223 -205
- package/dist-server/integrations/installation-state.mjs +84 -84
- package/dist-server/integrations/launcher-start.mjs +52 -0
- package/dist-server/integrations/npm-diagnostics.mjs +32 -0
- package/dist-server/integrations/runtime-gc.mjs +191 -188
- package/dist-server/integrations/runtime-identity.mjs +22 -0
- package/dist-server/integrations/runtime.mjs +111 -126
- package/dist-server/integrations/updates.mjs +258 -225
- package/dist-server/integrations/version-policy.mjs +32 -32
- package/dist-server/launcher.mjs +1845 -0
- package/dist-server/mcp/control-panel.mjs +8 -23
- package/dist-server/mcp/server.mjs +31 -80
- package/dist-server/mcp/update-session.mjs +107 -92
- package/dist-server/upstream/craft-aigc.mjs +43 -16
- package/dist-server/upstream/draft-source.mjs +29 -0
- package/package.json +3 -2
- package/resources/context-filter-report.json +1 -1
- package/resources/craft-create/SKILL.md +19 -19
- package/resources/craft-update/SKILL.md +9 -11
- package/resources/targets/claude/js/bootstrap/SKILL.md +3 -1
- package/resources/targets/claude/js/context-filter-report.json +1 -1
- package/resources/targets/claude/js/craft-game-maker/SKILL.md +11 -15
- package/resources/targets/claude/js/js/bundle.json +7 -7
- package/resources/targets/claude/js/recovery.md +5 -1
- package/resources/targets/claude/js/target.json +1 -1
- package/resources/targets/claude/js3d/bootstrap/SKILL.md +3 -1
- package/resources/targets/claude/js3d/context-filter-report.json +1 -1
- package/resources/targets/claude/js3d/craft-game-maker/SKILL.md +11 -15
- package/resources/targets/claude/js3d/js3d/bundle.json +7 -7
- package/resources/targets/claude/js3d/recovery.md +5 -1
- package/resources/targets/claude/js3d/target.json +1 -1
- package/resources/targets/codebuddy/js/bootstrap/SKILL.md +3 -1
- package/resources/targets/codebuddy/js/context-filter-report.json +1 -1
- package/resources/targets/codebuddy/js/craft-game-maker/SKILL.md +11 -15
- package/resources/targets/codebuddy/js/js/bundle.json +7 -7
- package/resources/targets/codebuddy/js/recovery.md +5 -1
- package/resources/targets/codebuddy/js/target.json +1 -1
- package/resources/targets/codebuddy/js3d/bootstrap/SKILL.md +3 -1
- package/resources/targets/codebuddy/js3d/context-filter-report.json +1 -1
- package/resources/targets/codebuddy/js3d/craft-game-maker/SKILL.md +11 -15
- package/resources/targets/codebuddy/js3d/js3d/bundle.json +7 -7
- package/resources/targets/codebuddy/js3d/recovery.md +5 -1
- package/resources/targets/codebuddy/js3d/target.json +1 -1
- package/resources/targets/codex/js/bootstrap/SKILL.md +2 -4
- package/resources/targets/codex/js/context-filter-report.json +1 -1
- package/resources/targets/codex/js/craft-game-maker/SKILL.md +11 -15
- package/resources/targets/codex/js/js/bundle.json +7 -7
- package/resources/targets/codex/js/recovery.md +3 -3
- package/resources/targets/codex/js/target.json +1 -1
- package/resources/targets/codex/js3d/bootstrap/SKILL.md +2 -4
- package/resources/targets/codex/js3d/context-filter-report.json +1 -1
- package/resources/targets/codex/js3d/craft-game-maker/SKILL.md +11 -15
- package/resources/targets/codex/js3d/js3d/bundle.json +7 -7
- package/resources/targets/codex/js3d/recovery.md +3 -3
- package/resources/targets/codex/js3d/target.json +1 -1
- package/resources/targets/cursor/js/bootstrap/SKILL.md +3 -1
- package/resources/targets/cursor/js/context-filter-report.json +1 -1
- package/resources/targets/cursor/js/craft-game-maker/SKILL.md +11 -15
- package/resources/targets/cursor/js/js/bundle.json +7 -7
- package/resources/targets/cursor/js/recovery.md +5 -1
- package/resources/targets/cursor/js/target.json +1 -1
- package/resources/targets/cursor/js3d/bootstrap/SKILL.md +3 -1
- package/resources/targets/cursor/js3d/context-filter-report.json +1 -1
- package/resources/targets/cursor/js3d/craft-game-maker/SKILL.md +11 -15
- package/resources/targets/cursor/js3d/js3d/bundle.json +7 -7
- package/resources/targets/cursor/js3d/recovery.md +5 -1
- package/resources/targets/cursor/js3d/target.json +1 -1
- package/resources/targets/dsh/js/bootstrap/SKILL.md +3 -1
- package/resources/targets/dsh/js/context-filter-report.json +1 -1
- package/resources/targets/dsh/js/craft-game-maker/SKILL.md +11 -15
- package/resources/targets/dsh/js/js/bundle.json +7 -7
- package/resources/targets/dsh/js/recovery.md +5 -1
- package/resources/targets/dsh/js/target.json +1 -1
- package/resources/targets/dsh/js3d/bootstrap/SKILL.md +3 -1
- package/resources/targets/dsh/js3d/context-filter-report.json +1 -1
- package/resources/targets/dsh/js3d/craft-game-maker/SKILL.md +11 -15
- package/resources/targets/dsh/js3d/js3d/bundle.json +7 -7
- package/resources/targets/dsh/js3d/recovery.md +5 -1
- package/resources/targets/dsh/js3d/target.json +1 -1
- package/resources/targets/index.json +32 -32
- package/resources/targets/kimi/js/bootstrap/SKILL.md +3 -1
- package/resources/targets/kimi/js/context-filter-report.json +1 -1
- package/resources/targets/kimi/js/craft-game-maker/SKILL.md +11 -15
- package/resources/targets/kimi/js/js/bundle.json +7 -7
- package/resources/targets/kimi/js/recovery.md +5 -1
- package/resources/targets/kimi/js/target.json +1 -1
- package/resources/targets/kimi/js3d/bootstrap/SKILL.md +3 -1
- package/resources/targets/kimi/js3d/context-filter-report.json +1 -1
- package/resources/targets/kimi/js3d/craft-game-maker/SKILL.md +11 -15
- package/resources/targets/kimi/js3d/js3d/bundle.json +7 -7
- package/resources/targets/kimi/js3d/recovery.md +5 -1
- package/resources/targets/kimi/js3d/target.json +1 -1
- package/resources/targets/workbuddy/js/bootstrap/SKILL.md +22 -24
- package/resources/targets/workbuddy/js/context-filter-report.json +1 -1
- package/resources/targets/workbuddy/js/craft-game-maker/SKILL.md +11 -15
- package/resources/targets/workbuddy/js/js/bundle.json +8 -8
- package/resources/targets/workbuddy/js/js/context/AGENTS.md +29 -29
- package/resources/targets/workbuddy/js/recovery.md +19 -19
- package/resources/targets/workbuddy/js/target.json +1 -1
- package/resources/targets/workbuddy/js3d/bootstrap/SKILL.md +22 -24
- package/resources/targets/workbuddy/js3d/context-filter-report.json +1 -1
- package/resources/targets/workbuddy/js3d/craft-game-maker/SKILL.md +11 -15
- package/resources/targets/workbuddy/js3d/js3d/bundle.json +8 -8
- package/resources/targets/workbuddy/js3d/js3d/context/AGENTS.md +30 -30
- package/resources/targets/workbuddy/js3d/recovery.md +19 -19
- package/resources/targets/workbuddy/js3d/target.json +1 -1
- package/resources/targets/zcode/js/bootstrap/SKILL.md +3 -1
- package/resources/targets/zcode/js/context-filter-report.json +1 -1
- package/resources/targets/zcode/js/craft-game-maker/SKILL.md +11 -15
- package/resources/targets/zcode/js/js/bundle.json +7 -7
- package/resources/targets/zcode/js/recovery.md +5 -1
- package/resources/targets/zcode/js/target.json +1 -1
- package/resources/targets/zcode/js3d/bootstrap/SKILL.md +3 -1
- package/resources/targets/zcode/js3d/context-filter-report.json +1 -1
- package/resources/targets/zcode/js3d/craft-game-maker/SKILL.md +11 -15
- package/resources/targets/zcode/js3d/js3d/bundle.json +7 -7
- package/resources/targets/zcode/js3d/recovery.md +5 -1
- package/resources/targets/zcode/js3d/target.json +1 -1
- package/vendor/craft-runtime/SOURCE.json +4 -4
- package/vendor/craft-runtime/package.json +1 -1
- package/dist-server/game-workflow/publication-materials.mjs +0 -92
- package/dist-server/game-workflow/publications.mjs +0 -168
- package/dist-server/game-workflow/publish-capture-worker.mjs +0 -57
- package/dist-server/game-workflow/publish-capture.mjs +0 -75
- package/dist-server/mcp/publication-page.html +0 -86
- package/dist-server/mcp/publication-page.mjs +0 -375
- package/dist-server/mcp/publication-preview.mjs +0 -63
- package/dist-server/mcp/publication-tools.mjs +0 -22
- package/dist-server/mcp/publish-panel.mjs +0 -210
- package/dist-server/upstream/publication-transport.mjs +0 -101
|
@@ -1,126 +1,111 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
export
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
const listed = await client.listTools();
|
|
113
|
-
const response = await client.callTool({ name: 'craft_game_info', arguments: {} });
|
|
114
|
-
if (response.isError) throw new Error('craft_game_info failed');
|
|
115
|
-
const info = response.structuredContent ?? JSON.parse(response.content.find(item => item.type === 'text').text);
|
|
116
|
-
if (!listed.tools.some(tool => tool.name === 'craft_game_prepare') || !listed.tools.some(tool => tool.name === 'craft_game_review')) throw new Error('Craft tools missing');
|
|
117
|
-
if(info.lifecycle && (!listed.tools.some(tool=>tool.name==='craft_game_release') || info.lifecycle.query_updates_context!==false)) throw new Error('Craft work lifecycle is incomplete');
|
|
118
|
-
if (expected.version && info.version !== expected.version) throw new Error('Runtime version mismatch');
|
|
119
|
-
if (expected.build_id && info.runtime?.build_id !== expected.build_id) throw new Error('Runtime build identity mismatch');
|
|
120
|
-
if (expected.host && info.host !== expected.host) throw new Error('Runtime host mismatch');
|
|
121
|
-
if (expected.workspace && path.resolve(info.workspace) !== path.resolve(expected.workspace)) throw new Error('Runtime workspace mismatch');
|
|
122
|
-
if (expected.platform && info.platform !== expected.platform) throw new Error('Runtime platform mismatch');
|
|
123
|
-
if (expected.host && ['js','js3d'].some(engine=>info.installed_contexts?.[engine]?.host !== expected.host)) throw new Error('Runtime context host mismatch');
|
|
124
|
-
return { scope: 'standalone_probe', version: info.version, runtime: info.runtime, host: info.host, workspace: info.workspace, platform: info.platform, tools: listed.tools.length, engines: info.supported_engines, contexts:info.installed_contexts };
|
|
125
|
-
} finally { await client.close(); await rm(state, { recursive: true, force: true }); }
|
|
126
|
-
}
|
|
1
|
+
import { getRuntimeIdentity } from './runtime-identity.mjs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import os from 'node:os';
|
|
4
|
+
import { existsSync } from 'node:fs';
|
|
5
|
+
import { mkdir, mkdtemp, readFile, writeFile, rename, rm, readdir, lstat } from 'node:fs/promises';
|
|
6
|
+
import { createHash } from 'node:crypto';
|
|
7
|
+
import { execFile } from 'node:child_process';
|
|
8
|
+
import { promisify } from 'node:util';
|
|
9
|
+
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
10
|
+
import { StdioClientTransport, getDefaultEnvironment } from '@modelcontextprotocol/sdk/client/stdio.js';
|
|
11
|
+
import { npmFailure } from './npm-diagnostics.mjs';
|
|
12
|
+
|
|
13
|
+
const execute = promisify(execFile);
|
|
14
|
+
export function npmEntry() {
|
|
15
|
+
for (const dir of [path.dirname(process.execPath), ...(process.env.PATH || process.env.Path || '').split(path.delimiter)]) {
|
|
16
|
+
for (const candidate of ['node_modules/npm/bin/npm-cli.js', '../lib/node_modules/npm/bin/npm-cli.js', '../share/nodejs/npm/bin/npm-cli.js']) {
|
|
17
|
+
const file = path.resolve(dir, candidate); if (existsSync(file)) return file;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
throw new Error('Node.js must include npm');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export async function runNpm(args, cwd) {
|
|
24
|
+
try { return await execute(process.execPath, [npmEntry(), ...args], { cwd, windowsHide: true, timeout: 180000, maxBuffer: 8 * 1024 * 1024 }); }
|
|
25
|
+
catch (error) { throw npmFailure(error); }
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { getRuntimeIdentity } from './runtime-identity.mjs';
|
|
29
|
+
|
|
30
|
+
export function verifyArchiveIntegrity(bytes, integrity) {
|
|
31
|
+
const candidates = String(integrity ?? '').trim().split(/\s+/).map(value => /^(sha512|sha384|sha256|sha1)-([A-Za-z0-9+/]+={0,2})$/.exec(value)).filter(Boolean);
|
|
32
|
+
if (!candidates.length) throw new Error('npm package has no supported integrity digest');
|
|
33
|
+
const order = ['sha512', 'sha384', 'sha256', 'sha1'];
|
|
34
|
+
const algorithm = order.find(value => candidates.some(item => item[1] === value));
|
|
35
|
+
const actual = createHash(algorithm).update(bytes).digest('base64');
|
|
36
|
+
if (!candidates.some(item => item[1] === algorithm && item[2] === actual)) throw new Error('npm package integrity mismatch');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async function stageArchive(archive, pkg, runtimeRoot, { registry, integrity } = {}) {
|
|
40
|
+
const bytes = await readFile(archive);
|
|
41
|
+
if (integrity) verifyArchiveIntegrity(bytes, integrity);
|
|
42
|
+
const hash = createHash('sha256').update(bytes).digest('hex');
|
|
43
|
+
const target = path.join(runtimeRoot, pkg.version + '-' + hash.slice(0, 16));
|
|
44
|
+
const packageRoot = path.join(target, 'node_modules', ...pkg.name.split('/'));
|
|
45
|
+
const metadata = path.join(target, 'craft-runtime.json');
|
|
46
|
+
if (!existsSync(metadata)) {
|
|
47
|
+
await mkdir(runtimeRoot, { recursive: true });
|
|
48
|
+
const staging = await mkdtemp(path.join(runtimeRoot, '.staging-'));
|
|
49
|
+
try {
|
|
50
|
+
await writeFile(path.join(staging, 'package.json'), '{"private":true}\n');
|
|
51
|
+
await runNpm(['install', '--ignore-scripts', '--engine-strict', '--no-audit', '--no-fund', '--omit=dev', ...(registry ? ['--registry=' + registry] : []), archive], staging);
|
|
52
|
+
const stagedRoot = path.join(staging, 'node_modules', ...pkg.name.split('/'));
|
|
53
|
+
const installed = JSON.parse(await readFile(path.join(stagedRoot, 'package.json'), 'utf8'));
|
|
54
|
+
if (installed.name !== pkg.name || installed.version !== pkg.version || !installed.bin?.['craft-mcp'] || !installed.files?.includes('resources')) throw new Error('Downloaded package is not the expected Craft distribution');
|
|
55
|
+
const identity = await getRuntimeIdentity(stagedRoot);
|
|
56
|
+
await writeFile(path.join(staging, 'craft-runtime.json'), JSON.stringify({ version: pkg.version, package: pkg.name, sha256: hash, build_id: identity.build_id, ...(integrity ? { integrity } : {}) }) + '\n');
|
|
57
|
+
await rename(staging, target);
|
|
58
|
+
} finally { await rm(staging, { recursive: true, force: true }); }
|
|
59
|
+
}
|
|
60
|
+
const recorded = JSON.parse(await readFile(metadata, 'utf8'));
|
|
61
|
+
const identity = await getRuntimeIdentity(packageRoot);
|
|
62
|
+
if (recorded.sha256 !== hash || recorded.package !== pkg.name || identity.package !== pkg.name || identity.version !== pkg.version || (recorded.build_id && recorded.build_id !== identity.build_id)) throw new Error('Cached Craft runtime integrity mismatch');
|
|
63
|
+
return { ...identity, sha256: hash, directory: target, ...(integrity ? { integrity } : {}) };
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export async function stageRuntime(packageRoot, runtimeRoot) {
|
|
67
|
+
const pkg = JSON.parse(await readFile(path.join(packageRoot, 'package.json'), 'utf8'));
|
|
68
|
+
if (!pkg.bin?.['craft-mcp'] || !pkg.files?.includes('resources')) throw new Error('Install from the built npm distribution, not the source/kit directory');
|
|
69
|
+
const temp = await mkdtemp(path.join(os.tmpdir(), 'craft-runtime-'));
|
|
70
|
+
try {
|
|
71
|
+
const packed = JSON.parse((await runNpm(['pack', '--ignore-scripts', '--json', '--pack-destination', temp], packageRoot)).stdout);
|
|
72
|
+
const archive = path.join(temp, packed[0].filename);
|
|
73
|
+
return await stageArchive(archive, pkg, runtimeRoot, { registry: pkg.publishConfig?.registry });
|
|
74
|
+
} finally { await rm(temp, { recursive: true, force: true }); }
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export async function stageRegistryRuntime(source, metadata, runtimeRoot) {
|
|
78
|
+
const temp = await mkdtemp(path.join(os.tmpdir(), 'craft-update-package-'));
|
|
79
|
+
try {
|
|
80
|
+
const packed = JSON.parse((await runNpm(['pack', source.package + '@' + metadata.version, '--ignore-scripts', '--json', '--registry=' + source.registry, '--pack-destination', temp], temp)).stdout);
|
|
81
|
+
if (!Array.isArray(packed) || packed.length !== 1 || path.basename(packed[0].filename) !== packed[0].filename) throw new Error('Unexpected npm package archive');
|
|
82
|
+
return await stageArchive(path.join(temp, packed[0].filename), { name: source.package, version: metadata.version }, runtimeRoot, { registry: source.registry, integrity: metadata.integrity });
|
|
83
|
+
} finally { await rm(temp, { recursive: true, force: true }); }
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export async function probeRuntime(connection, expected = {}) {
|
|
87
|
+
const state = await mkdtemp(path.join(os.tmpdir(), 'craft-probe-'));
|
|
88
|
+
const env = { ...getDefaultEnvironment(), ...connection.env, CLIENT_DATA_DIR: state, CRAFT_STANDALONE_PROBE: '1' };
|
|
89
|
+
delete env.CRAFT_RUNTIME_WORKER;
|
|
90
|
+
delete env.CRAFT_TOKEN; delete env.NODE_OPTIONS; delete env.CRAFT_MCP_RESOURCES_DIR; delete env.CRAFT_INSTALLATION_FILE;
|
|
91
|
+
const transport = new StdioClientTransport({ command: connection.command, args: connection.args, env, stderr: 'pipe' });
|
|
92
|
+
// Consume diagnostics without exposing config values or credentials in installer reports.
|
|
93
|
+
transport.stderr?.resume();
|
|
94
|
+
const client = new Client({ name: 'craft-install-check', version: '1.0.0' });
|
|
95
|
+
try {
|
|
96
|
+
await client.connect(transport, { timeout: 120000 });
|
|
97
|
+
const listed = await client.listTools();
|
|
98
|
+
const response = await client.callTool({ name: 'craft_game_info', arguments: {} });
|
|
99
|
+
if (response.isError) throw new Error('craft_game_info failed');
|
|
100
|
+
const info = response.structuredContent ?? JSON.parse(response.content.find(item => item.type === 'text').text);
|
|
101
|
+
if (!listed.tools.some(tool => tool.name === 'craft_game_prepare') || !listed.tools.some(tool => tool.name === 'craft_game_review')) throw new Error('Craft tools missing');
|
|
102
|
+
if(info.lifecycle && (!listed.tools.some(tool=>tool.name==='craft_game_release') || info.lifecycle.query_updates_context!==false)) throw new Error('Craft work lifecycle is incomplete');
|
|
103
|
+
if (expected.version && info.version !== expected.version) throw new Error('Runtime version mismatch');
|
|
104
|
+
if (expected.build_id && info.runtime?.build_id !== expected.build_id) throw new Error('Runtime build identity mismatch');
|
|
105
|
+
if (expected.host && info.host !== expected.host) throw new Error('Runtime host mismatch');
|
|
106
|
+
if (expected.workspace && path.resolve(info.workspace) !== path.resolve(expected.workspace)) throw new Error('Runtime workspace mismatch');
|
|
107
|
+
if (expected.platform && info.platform !== expected.platform) throw new Error('Runtime platform mismatch');
|
|
108
|
+
if (expected.host && ['js','js3d'].some(engine=>info.installed_contexts?.[engine]?.host !== expected.host)) throw new Error('Runtime context host mismatch');
|
|
109
|
+
return { scope: 'standalone_probe', version: info.version, runtime: info.runtime, host: info.host, workspace: info.workspace, platform: info.platform, tools: listed.tools.length, engines: info.supported_engines, contexts:info.installed_contexts };
|
|
110
|
+
} finally { await client.close(); await rm(state, { recursive: true, force: true }); }
|
|
111
|
+
}
|