@threenative/core 0.3.11 → 0.3.13
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 +1 -1
- package/capabilities.json +1988 -204
- package/dist/{assets-YUbXa3-Y.d.ts → assets-CfMKnOsK.d.ts} +78 -1
- package/dist/camera-shake-CZKOfGn4.d.ts +46 -0
- package/dist/{canvas-layer-vCtanIeB.d.ts → canvas-layer-G7ttVy7y.d.ts} +1 -1
- package/dist/chunk-4SRAQFTU.js +133 -0
- package/dist/chunk-CFGTPFUH.js +231 -0
- package/dist/chunk-DIPIJICH.js +8916 -0
- package/dist/chunk-EEABDLUC.js +2237 -0
- package/dist/chunk-EFWZWLPY.js +1895 -0
- package/dist/chunk-GXY7B3JG.js +46 -0
- package/dist/chunk-GYUZJQ7U.js +280 -0
- package/dist/chunk-H4J6IAJE.js +504 -0
- package/dist/chunk-KIRUKTBQ.js +187 -0
- package/dist/chunk-QWJEMUUT.js +94 -0
- package/dist/chunk-SV4QVUTQ.js +31 -0
- package/dist/chunk-U4YHUKKL.js +615 -0
- package/dist/chunk-VP43GIWW.js +18 -0
- package/dist/chunk-XDTZ4QMO.js +160 -0
- package/dist/default-tone-mapping-GgKPTiBP.d.ts +4 -0
- package/dist/{game-DzMcitDO.d.ts → game-k8K3hZai.d.ts} +85 -9
- package/dist/hot.d.ts +5 -4
- package/dist/hot.js +5 -52
- package/dist/index.d.ts +633 -1351
- package/dist/index.js +12873 -23068
- package/dist/{model-lod-CTpZ6imz.d.ts → model-lod-DPTzeCcD.d.ts} +35 -3
- package/dist/playtest.d.ts +5 -4
- package/dist/playtest.js +25 -75
- package/dist/quality-BYqKGAwo.d.ts +868 -0
- package/dist/react-css.js +1 -215
- package/dist/react.d.ts +3 -2
- package/dist/render-environment.d.ts +170 -0
- package/dist/render-environment.js +352 -0
- package/dist/{renderer-rZm0hVqq.d.ts → renderer-BtOSseYf.d.ts} +42 -35
- package/dist/spells/index.d.ts +643 -0
- package/dist/spells/index.js +1558 -0
- package/dist/spells/ultra/index.d.ts +1600 -0
- package/dist/spells/ultra/index.js +6804 -0
- package/dist/terrain-jobs-worker.js +1 -123
- package/dist/two-sided-foliage-W523J3UM.js +1 -0
- package/dist/ui-layer.js +6 -384
- package/dist/worker.js +13 -43
- package/dist/world.d.ts +988 -268
- package/dist/world.js +17464 -18290
- package/mcp/animation-server.mjs +1 -1
- package/mcp/animation.mjs +2 -3
- package/mcp/engine-server.mjs +245 -52
- package/mcp/servers.mjs +10 -3
- package/mcp/terrain.mjs +8 -0
- package/package.json +19 -7
- package/patches/three@0.187.0-prd269-upgrade.patch +2102 -0
- package/patches/three@0.187.0.patch +2004 -407
- package/src/animation-batch.ts +193 -0
- package/src/animation-layers.ts +7 -3
- package/src/animation.ts +209 -29
- package/src/asset-cache.ts +3 -3
- package/src/asset-memo.ts +202 -0
- package/src/assets.ts +437 -125
- package/src/auto-batch.ts +190 -44
- package/src/card-lod.ts +152 -0
- package/src/compressed-texture-preparation.ts +1008 -0
- package/src/compute-driven.ts +1 -1
- package/src/config.ts +8 -0
- package/src/debug.ts +103 -22
- package/src/dev-global.ts +54 -0
- package/src/engine-hooks.ts +37 -0
- package/src/frame-budget.ts +50 -23
- package/src/game-boot-phase.ts +269 -0
- package/src/game-dev-tools.ts +86 -0
- package/src/game-frame-loop.ts +958 -0
- package/src/game-renderer-metrics.ts +77 -0
- package/src/game-startup.ts +1076 -0
- package/src/game-ui.ts +84 -0
- package/src/game-validate.ts +70 -0
- package/src/game.ts +198 -2264
- package/src/gamepad-mappings.ts +269 -0
- package/src/generated/console-markers.ts +13 -0
- package/src/geometry-capture.ts +28 -4
- package/src/gpu-readings.ts +98 -0
- package/src/gpu-scene-bvh.ts +149 -36
- package/src/hot.ts +4 -7
- package/src/index.ts +141 -9
- package/src/input.ts +237 -25
- package/src/instanced-batch-lod.ts +3 -8
- package/src/interpolation.ts +171 -40
- package/src/launch-diagnostics.ts +22 -12
- package/src/look/ao-admission.ts +25 -0
- package/src/look/auto-exposure.ts +5 -16
- package/src/look/default-tone-mapping.ts +41 -5
- package/src/look/filmic-tone-mapping.ts +15 -13
- package/src/look/local-exposure.ts +2 -7
- package/src/look/look-diagnostics.ts +3 -3
- package/src/look/quad-pass.ts +21 -0
- package/src/look/quality.ts +14 -5
- package/src/look/unreal-bloom.ts +4 -13
- package/src/look/world-environment.ts +113 -103
- package/src/loop.ts +29 -0
- package/src/merge-parts.ts +20 -24
- package/src/model-lod.ts +139 -17
- package/src/particle-kinds.ts +515 -0
- package/src/particle-significance.ts +12 -0
- package/src/particles.ts +19 -10
- package/src/picking.ts +17 -3
- package/src/platform.ts +23 -4
- package/src/playtest.ts +27 -1
- package/src/profiling/FrameStages.ts +5 -6
- package/src/profiling/Spans.ts +3 -17
- package/src/profiling/debug-telemetry.ts +2 -6
- package/src/profiling/render-list-validate.ts +6 -15
- package/src/projection-apply.ts +4 -1
- package/src/projection-marker.ts +2 -1
- package/src/projection-plan.ts +9 -6
- package/src/quiet-markers.ts +3 -10
- package/src/render/cpu-bvh.ts +100 -0
- package/src/render/depth-pyramid.ts +6 -14
- package/src/render/environment/environmentContribution.ts +202 -0
- package/src/render/environment/environmentRadiance.ts +44 -0
- package/src/render/environment/environmentSampleCache.ts +56 -0
- package/src/render/environment/environmentSampling.ts +201 -0
- package/src/render/environment/environmentSnapshot.ts +71 -0
- package/src/render/environment/gate.ts +57 -0
- package/src/render/mesh-pool.ts +4 -20
- package/src/render/probe-trace.ts +872 -0
- package/src/render/probe-volume.ts +780 -34
- package/src/render/radiance-cache.ts +17 -0
- package/src/render/resolution-subrect.ts +2 -0
- package/src/render/rough-diffuse.ts +46 -12
- package/src/render/soft-shadow.ts +27 -12
- package/src/render/virtual-shadow-adaptive.ts +55 -0
- package/src/render/virtual-shadow-casters.ts +175 -0
- package/src/render/virtual-shadow-layers.ts +76 -0
- package/src/render/virtual-shadow-level.ts +224 -0
- package/src/render/virtual-shadow-markers.ts +193 -0
- package/src/render/virtual-shadow-options.ts +370 -0
- package/src/render/virtual-shadow-pages.ts +5 -0
- package/src/render/virtual-shadow-partial.ts +13 -0
- package/src/render/virtual-shadow.ts +231 -1008
- package/src/render/world-impostor-surface.ts +402 -40
- package/src/render/world-impostor.ts +5 -2
- package/src/render-camera-cull.ts +98 -3
- package/src/render-environment.ts +41 -0
- package/src/render-pass-budget.ts +34 -7
- package/src/renderProjection.ts +22 -0
- package/src/renderer-config.ts +36 -0
- package/src/renderer-facts.ts +37 -0
- package/src/renderer.ts +144 -65
- package/src/resolution-scaler.ts +3 -2
- package/src/scene-entry-inspectors.ts +61 -0
- package/src/snow-field.ts +2 -1
- package/src/spells/cast-pool.ts +361 -0
- package/src/spells/index.ts +177 -0
- package/src/spells/mechanisms.ts +295 -0
- package/src/spells/reaction-field.ts +415 -0
- package/src/spells/spell-lights.ts +139 -0
- package/src/spells/spell-world.ts +187 -0
- package/src/spells/spell.ts +397 -0
- package/src/spells/spells.ts +283 -0
- package/src/spells/ultra/engine/camera.ts +184 -0
- package/src/spells/ultra/engine/quality.ts +96 -0
- package/src/spells/ultra/index.ts +52 -0
- package/src/spells/ultra/main.ts +305 -0
- package/src/spells/ultra/scene/arenaMaterial.ts +325 -0
- package/src/spells/ultra/spells/cast.ts +233 -0
- package/src/spells/ultra/spells/fire.ts +1267 -0
- package/src/spells/ultra/vfx/FluidVolume.ts +816 -0
- package/src/spells/ultra/vfx/FluidVolume.tsl.ts +855 -0
- package/src/spells/ultra/vfx/FxTarget.ts +61 -0
- package/src/spells/ultra/vfx/GroundField.ts +1399 -0
- package/src/spells/ultra/vfx/Particles.ts +1475 -0
- package/src/spells/ultra/vfx/Ribbons.ts +645 -0
- package/src/spells/ultra/vfx/Shockwaves.ts +286 -0
- package/src/spells/ultra/vfx/Volumes.ts +489 -0
- package/src/spells/ultra/vfx/common.ts +1195 -0
- package/src/spells/ultra/vfx/noise.ts +441 -0
- package/src/startup-offscreen-bytes.ts +78 -0
- package/src/startup-readiness.ts +128 -34
- package/src/static-transform.ts +25 -19
- package/src/streamed-textures.ts +112 -0
- package/src/streaming.ts +68 -4
- package/src/texture-streaming.ts +331 -0
- package/src/version.ts +1 -1
- package/src/warmup.ts +56 -8
- package/src/water-surface.ts +9 -3
- package/src/worker.ts +12 -2
- package/src/world-bundle-safety.ts +446 -0
- package/src/world-cell-batches.ts +1178 -0
- package/src/world-cell-chunks.ts +1128 -0
- package/src/world-cell-data.ts +995 -0
- package/src/world-cell-impostors.ts +1461 -0
- package/src/world-cell-lod-bias.ts +151 -0
- package/src/world-cell-models.ts +1074 -0
- package/src/world-cell-options.ts +177 -0
- package/src/world-cell-placements.ts +798 -0
- package/src/world-cell-prewarm.ts +592 -0
- package/src/world-cell-readiness.ts +357 -0
- package/src/world-cell-records.ts +401 -0
- package/src/world-cell-render-bundles.ts +459 -0
- package/src/world-cell-render-gpu-dress.ts +710 -0
- package/src/world-cell-render-main-cull.ts +540 -0
- package/src/world-cell-render-shadow-claims.ts +198 -0
- package/src/world-cell-render-util.ts +259 -0
- package/src/world-cell-render.ts +1501 -0
- package/src/world-cell-residency.ts +754 -0
- package/src/world-cell-stale.ts +238 -0
- package/src/world-cells.ts +1335 -10418
- package/src/world-chunk-shadow.ts +308 -0
- package/src/world-collar.ts +315 -0
- package/src/world-gpu-flags.ts +131 -0
- package/src/world-gpu-readback.ts +881 -0
- package/src/world-gpu-reference.ts +524 -0
- package/src/world-gpu-scene.ts +256 -2286
- package/src/world-gpu-shadow.ts +203 -0
- package/src/world-gpu-types.ts +409 -0
- package/src/world-gpu-validation.ts +518 -0
- package/src/world-heightfield.ts +802 -0
- package/src/world-load-limiter.ts +111 -0
- package/src/world-model-sections.ts +80 -0
- package/src/world-noise.ts +241 -0
- package/src/world-package.ts +42 -0
- package/src/world-region.ts +1 -1
- package/src/world-river-ribbon.ts +282 -0
- package/src/world-root-frame.ts +39 -0
- package/src/world-shore-field.ts +91 -0
- package/src/world-static-pose.ts +163 -0
- package/src/world-surface-sampler.ts +48 -0
- package/src/world-terrain-splat.ts +361 -153
- package/src/world-tile-budget.ts +249 -0
- package/src/world-tile-geometry.ts +469 -0
- package/src/world-tile-lod.ts +408 -0
- package/src/world-tile-observation.ts +566 -0
- package/src/world-tile-stitch.ts +166 -0
- package/src/world-tiles.ts +247 -1755
- package/src/world-validate.ts +6 -14
- package/src/world-warm.ts +51 -0
- package/src/world-water-bodies.ts +359 -0
- package/src/world.ts +48 -741
package/mcp/engine-server.mjs
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { realpathSync, readFileSync, existsSync, mkdirSync, rmSync, writeFileSync, appendFileSync, renameSync, readdirSync } from 'fs';
|
|
3
|
-
import
|
|
2
|
+
import { realpathSync, readFileSync, existsSync, mkdirSync, rmSync, writeFileSync, appendFileSync, mkdtempSync, renameSync, readdirSync } from 'fs';
|
|
3
|
+
import path from 'path';
|
|
4
4
|
import { createInterface } from 'readline';
|
|
5
5
|
import { fileURLToPath } from 'url';
|
|
6
|
+
import { execFile } from 'child_process';
|
|
6
7
|
import { createHash } from 'crypto';
|
|
7
8
|
import os from 'os';
|
|
9
|
+
import { promisify } from 'util';
|
|
8
10
|
import { gunzipSync } from 'zlib';
|
|
9
11
|
|
|
10
12
|
var DEFAULT_REFERENCES_URL = "https://github.com/ThreeNativeHQ/threenative-reverse-engineer-mcp/releases/latest/download/";
|
|
@@ -18,12 +20,12 @@ function referencesBaseUrl() {
|
|
|
18
20
|
function referencesCacheDir() {
|
|
19
21
|
const override = process.env.THREENATIVE_REFERENCES_CACHE?.trim();
|
|
20
22
|
const source = createHash("sha256").update(referencesBaseUrl()).digest("hex").slice(0, 16);
|
|
21
|
-
if (override) return
|
|
22
|
-
const cacheHome = process.env.XDG_CACHE_HOME?.trim() ||
|
|
23
|
-
return
|
|
23
|
+
if (override) return path.join(path.resolve(override), source);
|
|
24
|
+
const cacheHome = process.env.XDG_CACHE_HOME?.trim() || path.join(os.homedir(), ".cache");
|
|
25
|
+
return path.join(cacheHome, "threenative", "refs", source);
|
|
24
26
|
}
|
|
25
27
|
function localReferencesDir(cwd = process.cwd()) {
|
|
26
|
-
return
|
|
28
|
+
return path.join(cwd, ".threenative", "refs");
|
|
27
29
|
}
|
|
28
30
|
function fail(where, reason) {
|
|
29
31
|
throw new Error(`TN_REFERENCES_MALFORMED: ${where}: ${reason}`);
|
|
@@ -61,7 +63,7 @@ function line(value, where) {
|
|
|
61
63
|
}
|
|
62
64
|
function sourcePath(value, where) {
|
|
63
65
|
const result = text(value, where);
|
|
64
|
-
if (
|
|
66
|
+
if (path.isAbsolute(result) || result.split("/").includes("..") || !/^[a-zA-Z0-9_./-]+$/u.test(result))
|
|
65
67
|
fail(where, "expected a safe relative source path");
|
|
66
68
|
return result;
|
|
67
69
|
}
|
|
@@ -275,7 +277,7 @@ function referenceStubs(game) {
|
|
|
275
277
|
];
|
|
276
278
|
}
|
|
277
279
|
async function cachedAsset(name, parse, timeout = FETCH_TIMEOUT_MS) {
|
|
278
|
-
const file =
|
|
280
|
+
const file = path.join(referencesCacheDir(), name);
|
|
279
281
|
const etagFile = `${file}.etag`;
|
|
280
282
|
let response;
|
|
281
283
|
try {
|
|
@@ -301,7 +303,7 @@ async function cachedAsset(name, parse, timeout = FETCH_TIMEOUT_MS) {
|
|
|
301
303
|
throw new Error(`TN_REFERENCES_UNAVAILABLE: ${name}: ${String(error)}`);
|
|
302
304
|
}
|
|
303
305
|
const parsed = parse(body);
|
|
304
|
-
mkdirSync(
|
|
306
|
+
mkdirSync(path.dirname(file), { recursive: true });
|
|
305
307
|
atomicWrite(file, body);
|
|
306
308
|
const etag = response.headers.get("etag");
|
|
307
309
|
if (etag === null) rmSync(etagFile, { force: true });
|
|
@@ -332,17 +334,17 @@ function loadLocalReferenceGames(cwd = process.cwd()) {
|
|
|
332
334
|
if (!existsSync(directory)) return [];
|
|
333
335
|
return readdirSync(directory).filter((file) => file.endsWith(".json")).sort().map((file) => {
|
|
334
336
|
const game = validateReferenceGame(
|
|
335
|
-
parseJson(readFileSync(
|
|
336
|
-
|
|
337
|
+
parseJson(readFileSync(path.join(directory, file)), file),
|
|
338
|
+
path.join(".threenative", "refs", file)
|
|
337
339
|
);
|
|
338
|
-
if (game.id !==
|
|
340
|
+
if (game.id !== path.basename(file, ".json"))
|
|
339
341
|
fail(file, `id '${game.id}' differs from filename`);
|
|
340
342
|
return game;
|
|
341
343
|
});
|
|
342
344
|
}
|
|
343
345
|
function loadReferenceGame(gameId, cwd = process.cwd()) {
|
|
344
346
|
id(gameId, "game id");
|
|
345
|
-
const file =
|
|
347
|
+
const file = path.join(localReferencesDir(cwd), `${gameId}.json`);
|
|
346
348
|
if (existsSync(file)) {
|
|
347
349
|
const local = validateReferenceGame(parseJson(readFileSync(file), file), file);
|
|
348
350
|
if (local.id !== gameId) fail(file, `id '${local.id}' differs from requested '${gameId}'`);
|
|
@@ -394,7 +396,7 @@ function saveReferenceGame(value, cwd = process.cwd()) {
|
|
|
394
396
|
"cards"
|
|
395
397
|
]);
|
|
396
398
|
const gameId = id(incoming.id, "reference.id");
|
|
397
|
-
const file =
|
|
399
|
+
const file = path.join(localReferencesDir(cwd), `${gameId}.json`);
|
|
398
400
|
const previous = existsSync(file) ? validateReferenceGame(parseJson(readFileSync(file), file), file) : void 0;
|
|
399
401
|
if (previous !== void 0 && previous.sha !== incoming.sha)
|
|
400
402
|
fail(
|
|
@@ -418,10 +420,10 @@ function saveReferenceGame(value, cwd = process.cwd()) {
|
|
|
418
420
|
},
|
|
419
421
|
"reference"
|
|
420
422
|
);
|
|
421
|
-
mkdirSync(
|
|
423
|
+
mkdirSync(path.dirname(file), { recursive: true });
|
|
422
424
|
atomicWrite(file, `${JSON.stringify(merged, null, 2)}
|
|
423
425
|
`);
|
|
424
|
-
const relative =
|
|
426
|
+
const relative = path.relative(cwd, file);
|
|
425
427
|
const title = `Reference cards: ${merged.title} (${merged.nodes.length} nodes, ${merged.cards.length} cards)`;
|
|
426
428
|
return {
|
|
427
429
|
contribution: {
|
|
@@ -431,6 +433,54 @@ function saveReferenceGame(value, cwd = process.cwd()) {
|
|
|
431
433
|
saved: relative
|
|
432
434
|
};
|
|
433
435
|
}
|
|
436
|
+
var WATCH_TOOLS = [
|
|
437
|
+
["yt-dlp", "install it with `pipx install yt-dlp`"],
|
|
438
|
+
["ffmpeg", "install it with `sudo apt install ffmpeg` or `brew install ffmpeg`"]
|
|
439
|
+
];
|
|
440
|
+
var WATCH_TIMEOUT_MS = 3e5;
|
|
441
|
+
function onPath(name) {
|
|
442
|
+
return [
|
|
443
|
+
...(process.env.PATH ?? "").split(path.delimiter),
|
|
444
|
+
path.join(os.homedir(), ".local", "bin")
|
|
445
|
+
].filter((directory) => directory.length > 0).some((directory) => existsSync(path.join(directory, name)));
|
|
446
|
+
}
|
|
447
|
+
async function watchReference(options) {
|
|
448
|
+
for (const [name, install] of WATCH_TOOLS)
|
|
449
|
+
if (!onPath(name))
|
|
450
|
+
throw new Error(`TN_WATCH_TOOL_MISSING: ${name} is not on PATH: ${install}.`);
|
|
451
|
+
const url = new URL("watch.mjs", referencesBaseUrl()).href;
|
|
452
|
+
try {
|
|
453
|
+
await cachedAsset("watch.mjs", (body) => body, GAME_FETCH_TIMEOUT_MS);
|
|
454
|
+
} catch (error) {
|
|
455
|
+
throw new Error(`TN_WATCH_UNAVAILABLE: cannot fetch ${url}: ${String(error)}`);
|
|
456
|
+
}
|
|
457
|
+
const out = mkdtempSync(path.join(os.tmpdir(), "threenative-watch-"));
|
|
458
|
+
const flags = Object.entries({
|
|
459
|
+
"--duration": options.duration,
|
|
460
|
+
"--frames": options.frames,
|
|
461
|
+
"--at": options.at,
|
|
462
|
+
"--pick": options.pick,
|
|
463
|
+
"--from": options.from
|
|
464
|
+
}).flatMap(([flag, value]) => value === void 0 ? [] : [flag, String(value)]);
|
|
465
|
+
try {
|
|
466
|
+
await promisify(execFile)(
|
|
467
|
+
process.execPath,
|
|
468
|
+
[path.join(referencesCacheDir(), "watch.mjs"), options.query, ...flags, "--out", out],
|
|
469
|
+
{ maxBuffer: 16 * 1024 * 1024, timeout: WATCH_TIMEOUT_MS }
|
|
470
|
+
);
|
|
471
|
+
} catch (error) {
|
|
472
|
+
rmSync(out, { recursive: true, force: true });
|
|
473
|
+
const stderr = String(error.stderr ?? "").trim();
|
|
474
|
+
throw new Error(`TN_WATCH_FAILED: ${stderr || String(error)}`);
|
|
475
|
+
}
|
|
476
|
+
const watch = JSON.parse(readFileSync(path.join(out, "watch.json"), "utf8"));
|
|
477
|
+
return {
|
|
478
|
+
sheet: watch.sheet === null ? null : path.join(out, watch.sheet),
|
|
479
|
+
frames: watch.frames.map((frame) => path.join(out, frame.path)),
|
|
480
|
+
watch,
|
|
481
|
+
guidance: "Read the sheet first: every frame in order. Then aim with pick, from or at. Reference only: borrow the mechanic, never commit the frames."
|
|
482
|
+
};
|
|
483
|
+
}
|
|
434
484
|
|
|
435
485
|
// src/index.ts
|
|
436
486
|
var ENGINE_MCP_TOOL_NAMES = [
|
|
@@ -438,7 +488,8 @@ var ENGINE_MCP_TOOL_NAMES = [
|
|
|
438
488
|
"engine_capability_detail",
|
|
439
489
|
"engine_search_references",
|
|
440
490
|
"engine_reference_detail",
|
|
441
|
-
"engine_save_reference"
|
|
491
|
+
"engine_save_reference",
|
|
492
|
+
"engine_watch_reference"
|
|
442
493
|
];
|
|
443
494
|
var DEFAULT_MANIFEST_FILE = "capabilities.json";
|
|
444
495
|
var STOP_WORDS = /* @__PURE__ */ new Set([
|
|
@@ -486,6 +537,7 @@ var STOP_WORDS = /* @__PURE__ */ new Set([
|
|
|
486
537
|
"is",
|
|
487
538
|
"it",
|
|
488
539
|
"its",
|
|
540
|
+
"keep",
|
|
489
541
|
"let",
|
|
490
542
|
"made",
|
|
491
543
|
"make",
|
|
@@ -557,29 +609,29 @@ var STOP_WORDS = /* @__PURE__ */ new Set([
|
|
|
557
609
|
var MAX_COMPLETE_REQUEST_RESULTS = 15;
|
|
558
610
|
var MAX_SITUATION_RESULTS = 5;
|
|
559
611
|
var RELEVANCE_FLOOR = 0.27;
|
|
560
|
-
var AUTHORING_INSTRUCTIONS = "
|
|
612
|
+
var AUTHORING_INSTRUCTIONS = "Follow the Authoring flow in the game's AGENTS.md (the threenative-capabilities skill holds the detail): search capabilities and references before the first new src/ file, for a new game and for every change to an existing game. Follow binding capability constraints. Execute with subagents focused on specific areas: bounded tasks, file ownership, then coordinator integration before mechanics playtests. References borrow mechanics only: no code, level layouts, character names or art; cite pinned file:line sources.";
|
|
561
613
|
var GENERIC_GUIDANCE = "No installed engine capability matches this situation. Decompose it into concrete mechanics and write the game-owned behavior in your project's src/; inspect the relevant template AGENTS.md before adding a package.";
|
|
562
614
|
function defaultManifestPath(cwd = process.cwd()) {
|
|
563
615
|
const override = process.env.THREENATIVE_CAPABILITIES_MANIFEST;
|
|
564
|
-
if (override !== void 0 && override.trim().length > 0) return
|
|
565
|
-
for (let directory =
|
|
566
|
-
const nodeModules =
|
|
567
|
-
const installed =
|
|
616
|
+
if (override !== void 0 && override.trim().length > 0) return path.resolve(cwd, override);
|
|
617
|
+
for (let directory = path.resolve(cwd); ; directory = path.dirname(directory)) {
|
|
618
|
+
const nodeModules = path.join(directory, "node_modules");
|
|
619
|
+
const installed = path.join(nodeModules, "@threenative", "core", "capabilities.json");
|
|
568
620
|
if (existsSync(installed)) {
|
|
569
|
-
const relative =
|
|
570
|
-
if (relative !== ".." && !relative.startsWith(`..${
|
|
621
|
+
const relative = path.relative(realpathSync(directory), realpathSync(nodeModules));
|
|
622
|
+
if (relative !== ".." && !relative.startsWith(`..${path.sep}`) && !path.isAbsolute(relative))
|
|
571
623
|
return installed;
|
|
572
624
|
}
|
|
573
|
-
const parent =
|
|
625
|
+
const parent = path.dirname(directory);
|
|
574
626
|
if (parent === directory) break;
|
|
575
627
|
}
|
|
576
|
-
for (let directory =
|
|
577
|
-
const repository =
|
|
628
|
+
for (let directory = path.dirname(fileURLToPath(import.meta.url)); ; directory = path.dirname(directory)) {
|
|
629
|
+
const repository = path.join(directory, "packages", "core", "capabilities.json");
|
|
578
630
|
if (existsSync(repository)) return repository;
|
|
579
|
-
const parent =
|
|
631
|
+
const parent = path.dirname(directory);
|
|
580
632
|
if (parent === directory) break;
|
|
581
633
|
}
|
|
582
|
-
return
|
|
634
|
+
return path.resolve(cwd, DEFAULT_MANIFEST_FILE);
|
|
583
635
|
}
|
|
584
636
|
function manifestError(file, reason) {
|
|
585
637
|
return new Error(`TN_ENGINE_CAPABILITIES_MANIFEST: ${file}: ${reason}`);
|
|
@@ -651,8 +703,12 @@ function suffixStripped(token) {
|
|
|
651
703
|
if (token.length > 3 && token.endsWith("s") && !token.endsWith("ss")) return token.slice(0, -1);
|
|
652
704
|
return token;
|
|
653
705
|
}
|
|
706
|
+
var STOP_WORD_STEMS = new Set([...STOP_WORDS].map(stem));
|
|
707
|
+
function splitSymbolCase(value) {
|
|
708
|
+
return value.replace(/([a-z0-9])([A-Z])/gu, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/gu, "$1 $2");
|
|
709
|
+
}
|
|
654
710
|
function capabilitySituationTokens(value) {
|
|
655
|
-
return value.toLocaleLowerCase().split(/[^a-z0-9]+/u).filter((token) => token.length > 1 && !STOP_WORDS.has(token)).map(stem);
|
|
711
|
+
return splitSymbolCase(value).toLocaleLowerCase().split(/[^a-z0-9]+/u).filter((token) => token.length > 1 && !STOP_WORDS.has(token)).map(stem).filter((token) => !STOP_WORD_STEMS.has(token));
|
|
656
712
|
}
|
|
657
713
|
var tokens = capabilitySituationTokens;
|
|
658
714
|
function tokenWeights(entries) {
|
|
@@ -672,6 +728,36 @@ function tokenWeights(entries) {
|
|
|
672
728
|
function weightOf(weights, token) {
|
|
673
729
|
return weights.get(token) ?? 0;
|
|
674
730
|
}
|
|
731
|
+
function nameWords(value) {
|
|
732
|
+
return tokens(value.replace(/([a-zA-Z])(\d+)/gu, "$1 $2")).filter((token) => !/\d/u.test(token));
|
|
733
|
+
}
|
|
734
|
+
function normaliseName(value) {
|
|
735
|
+
return value.toLocaleLowerCase().replace(/[^a-z0-9]+/gu, "");
|
|
736
|
+
}
|
|
737
|
+
function spelledWords(value) {
|
|
738
|
+
return value.toLocaleLowerCase().split(/[^a-z0-9]+/u).filter((word) => word.length > 0);
|
|
739
|
+
}
|
|
740
|
+
function spellsName(situation, symbol) {
|
|
741
|
+
const words = spelledWords(situation);
|
|
742
|
+
const whole = normaliseName(symbol);
|
|
743
|
+
for (let start = 0; start < words.length; start += 1) {
|
|
744
|
+
let piece = "";
|
|
745
|
+
for (let end = start; end < words.length && end < start + 4; end += 1) {
|
|
746
|
+
piece += normaliseName(words[end] ?? "");
|
|
747
|
+
if (piece === whole) return true;
|
|
748
|
+
if (piece.length >= whole.length) break;
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
return false;
|
|
752
|
+
}
|
|
753
|
+
function nameTokenWeights(entries) {
|
|
754
|
+
return tokenWeights(
|
|
755
|
+
entries.map((entry) => ({
|
|
756
|
+
aliases: [nameWords(entry.symbol).join(" ")],
|
|
757
|
+
situations: [entry.summary]
|
|
758
|
+
}))
|
|
759
|
+
);
|
|
760
|
+
}
|
|
675
761
|
var DISTINCTIVE_SITUATION_SHARE = 0.02;
|
|
676
762
|
var DISTINCTIVE_FLOOR = Math.log(1 + 1 / DISTINCTIVE_SITUATION_SHARE);
|
|
677
763
|
var AGREEMENT_WEIGHT = 0.4;
|
|
@@ -732,6 +818,62 @@ function situationScore(query, situations, aliases, weights) {
|
|
|
732
818
|
const matchedSituation = readable.matchedSituation.length > 0 ? readable.matchedSituation : best >= RELEVANCE_FLOOR ? readable.bestReadableSituation : "";
|
|
733
819
|
return matchedSituation.length > 0 ? { matchedSituation, score: best } : { matchedSituation: "", score: 0 };
|
|
734
820
|
}
|
|
821
|
+
var EXACT_SYMBOL_LEAD = 4;
|
|
822
|
+
var NAME_BASE_LEAD = 2;
|
|
823
|
+
var NAME_SHARE_LEAD = 1.4;
|
|
824
|
+
var SYMBOL_WEIGHT_FLOOR = 4.2;
|
|
825
|
+
var SINGLE_WORD_SHARE_FLOOR = 0.3;
|
|
826
|
+
function scoreSymbolName(symbol, situation, queryTokens, weights) {
|
|
827
|
+
const name = [...new Set(nameWords(symbol))];
|
|
828
|
+
if (name.length === 0) return void 0;
|
|
829
|
+
const nameWeights = name.map((token) => weightOf(weights, token));
|
|
830
|
+
const specificity = nameWeights.reduce((sum, weight) => sum + weight, 0);
|
|
831
|
+
const requestTotal = [...queryTokens].reduce((sum, token) => sum + weightOf(weights, token), 0);
|
|
832
|
+
const share = requestTotal === 0 ? 0 : specificity / requestTotal;
|
|
833
|
+
const nameScore = NAME_BASE_LEAD + NAME_SHARE_LEAD * Math.min(1, share);
|
|
834
|
+
if (spellsName(situation, symbol)) {
|
|
835
|
+
if (normaliseName(situation) === normaliseName(symbol)) {
|
|
836
|
+
return { score: EXACT_SYMBOL_LEAD, specificity };
|
|
837
|
+
}
|
|
838
|
+
if (name.length === 1) {
|
|
839
|
+
if (weightOf(weights, name[0] ?? "") < SYMBOL_WEIGHT_FLOOR) return void 0;
|
|
840
|
+
if (share < SINGLE_WORD_SHARE_FLOOR) return void 0;
|
|
841
|
+
return { score: (NAME_BASE_LEAD + NAME_SHARE_LEAD) * Math.min(1, share), specificity };
|
|
842
|
+
}
|
|
843
|
+
return { score: nameScore, specificity };
|
|
844
|
+
}
|
|
845
|
+
if (name.length < 2) return void 0;
|
|
846
|
+
const queryWords = new Set(nameWords(situation));
|
|
847
|
+
if (!name.every((token) => queryWords.has(token))) return void 0;
|
|
848
|
+
if (Math.max(...nameWeights) < SYMBOL_WEIGHT_FLOOR) return void 0;
|
|
849
|
+
return { score: nameScore, specificity };
|
|
850
|
+
}
|
|
851
|
+
var SUMMARY_WEIGHT = 0.4;
|
|
852
|
+
function summaryScore(summary, queryTokens, queryText, weights) {
|
|
853
|
+
const candidate = scorePhrase(summary, queryTokens, queryText, weights);
|
|
854
|
+
return candidate === void 0 ? 0 : candidate.score * SUMMARY_WEIGHT;
|
|
855
|
+
}
|
|
856
|
+
function capabilityScore(query, entry, weights, nameWeights, situation) {
|
|
857
|
+
const situations = {
|
|
858
|
+
...situationScore(query, entry.situations, entry.aliases, weights),
|
|
859
|
+
specificity: 0
|
|
860
|
+
};
|
|
861
|
+
if (query.length === 0) return situations;
|
|
862
|
+
const queryTokens = new Set(query);
|
|
863
|
+
const symbol = scoreSymbolName(entry.symbol, situation, queryTokens, nameWeights);
|
|
864
|
+
const summary = summaryScore(entry.summary, queryTokens, query.join(" "), nameWeights);
|
|
865
|
+
const symbolScore = symbol?.score ?? 0;
|
|
866
|
+
const best = Math.max(situations.score, symbolScore, summary);
|
|
867
|
+
if (best <= situations.score) return situations;
|
|
868
|
+
if (symbol !== void 0 && symbolScore >= best) {
|
|
869
|
+
return { matchedSituation: entry.symbol, score: symbolScore, specificity: symbol.specificity };
|
|
870
|
+
}
|
|
871
|
+
return {
|
|
872
|
+
matchedSituation: situations.matchedSituation || entry.situations[0] || entry.summary,
|
|
873
|
+
score: best,
|
|
874
|
+
specificity: 0
|
|
875
|
+
};
|
|
876
|
+
}
|
|
735
877
|
function notOwnedSituationScore(query, situations) {
|
|
736
878
|
if (query.length === 0) return { matchedSituation: "", score: 0 };
|
|
737
879
|
const queryText = query.join(" ");
|
|
@@ -817,10 +959,11 @@ var REVERSE_ENGINEER = /\breverse[\s-]?engineer|\bdecomp|\bdisassembl/iu;
|
|
|
817
959
|
var REFERENCE_TOOLS = [
|
|
818
960
|
"engine_search_references",
|
|
819
961
|
"engine_reference_detail",
|
|
820
|
-
"engine_save_reference"
|
|
962
|
+
"engine_save_reference",
|
|
963
|
+
"engine_watch_reference"
|
|
821
964
|
];
|
|
822
965
|
function withReferenceTools(situation, response) {
|
|
823
|
-
if (!REVERSE_ENGINEER.test(situation)) return response;
|
|
966
|
+
if (!REVERSE_ENGINEER.test(situation)) return { referenceTools: REFERENCE_TOOLS, ...response };
|
|
824
967
|
return {
|
|
825
968
|
referenceTools: REFERENCE_TOOLS,
|
|
826
969
|
...response,
|
|
@@ -831,6 +974,7 @@ function searchMechanics(situation, manifest, scope) {
|
|
|
831
974
|
const query = tokens(situation);
|
|
832
975
|
const limit = scope === "request" ? MAX_COMPLETE_REQUEST_RESULTS : MAX_SITUATION_RESULTS;
|
|
833
976
|
const weights = tokenWeights(manifest.entries);
|
|
977
|
+
const nameWeights = nameTokenWeights(manifest.entries);
|
|
834
978
|
const notOwned = notOwnedMatch(manifest, query);
|
|
835
979
|
if (notOwned !== void 0 && isSpecificNotOwnedMatch(query, notOwned.matchedSituation)) {
|
|
836
980
|
return {
|
|
@@ -839,10 +983,10 @@ function searchMechanics(situation, manifest, scope) {
|
|
|
839
983
|
verdict: "none"
|
|
840
984
|
};
|
|
841
985
|
}
|
|
842
|
-
const results = manifest.entries.map((entry) => ({ entry, ...
|
|
986
|
+
const results = manifest.entries.map((entry) => ({ entry, ...capabilityScore(query, entry, weights, nameWeights, situation) })).filter(
|
|
843
987
|
({ matchedSituation, score }) => matchedSituation.length > 0 && score >= RELEVANCE_FLOOR
|
|
844
988
|
).sort(
|
|
845
|
-
(left, right) => right.score - left.score || `${left.entry.importPath}:${left.entry.symbol}`.localeCompare(
|
|
989
|
+
(left, right) => right.score - left.score || right.specificity - left.specificity || `${left.entry.importPath}:${left.entry.symbol}`.localeCompare(
|
|
846
990
|
`${right.entry.importPath}:${right.entry.symbol}`
|
|
847
991
|
)
|
|
848
992
|
).filter(
|
|
@@ -851,11 +995,14 @@ function searchMechanics(situation, manifest, scope) {
|
|
|
851
995
|
) === index
|
|
852
996
|
).slice(0, limit).map(({ entry, matchedSituation, score }) => ({
|
|
853
997
|
constraints: entry.constraints,
|
|
998
|
+
...entry.deprecated === void 0 ? {} : { deprecated: entry.deprecated },
|
|
854
999
|
example: entry.example,
|
|
855
1000
|
importPath: entry.importPath,
|
|
856
1001
|
matchedSituation,
|
|
1002
|
+
...entry.overrides === void 0 ? {} : { overrides: entry.overrides },
|
|
857
1003
|
...entry.requires === void 0 ? {} : { requires: entry.requires },
|
|
858
1004
|
score,
|
|
1005
|
+
signature: entry.signature,
|
|
859
1006
|
summary: entry.summary,
|
|
860
1007
|
symbol: entry.symbol
|
|
861
1008
|
}));
|
|
@@ -890,7 +1037,7 @@ var TOOL_DEFINITIONS = [
|
|
|
890
1037
|
{
|
|
891
1038
|
annotations: { destructiveHint: false, openWorldHint: false, readOnlyHint: true },
|
|
892
1039
|
name: "engine_search_capabilities",
|
|
893
|
-
description: 'Search the installed engine by concrete gameplay mechanic. Decompose genres first. Use scope "request" for the mechanically explicit full request and "mechanic" for each focused search; matchedSituation and score explain every result. The response verdict "none" is an actionable answer with guidance, not a failed search.',
|
|
1040
|
+
description: 'Search the installed engine by concrete gameplay mechanic or by an exact exported symbol name. Decompose genres first. Use scope "request" for the mechanically explicit full request and "mechanic" for each focused search; matchedSituation and score explain every result. A row carries the answer (importPath, signature, example, constraints, overrides, deprecations), so call engine_capability_detail only for a symbol the search did not return. The response verdict "none" is an actionable answer with guidance, not a failed search.',
|
|
894
1041
|
inputSchema: {
|
|
895
1042
|
additionalProperties: false,
|
|
896
1043
|
properties: {
|
|
@@ -963,19 +1110,43 @@ var TOOL_DEFINITIONS = [
|
|
|
963
1110
|
},
|
|
964
1111
|
required: ["game"]
|
|
965
1112
|
}
|
|
1113
|
+
},
|
|
1114
|
+
{
|
|
1115
|
+
name: "engine_watch_reference",
|
|
1116
|
+
description: "Watch what you reverse engineer: see a game mechanic before you build it. Searches YouTube for gameplay of a reference game, download one short segment and slice frames plus one contact sheet into a tmp folder. Returns sheet (read it first), frames and watch.json (video, segment, frame times). Needs yt-dlp and ffmpeg. Frames are reference only: never commit them.",
|
|
1117
|
+
annotations: { destructiveHint: false, openWorldHint: true, readOnlyHint: true },
|
|
1118
|
+
inputSchema: {
|
|
1119
|
+
type: "object",
|
|
1120
|
+
additionalProperties: false,
|
|
1121
|
+
properties: {
|
|
1122
|
+
query: {
|
|
1123
|
+
type: "string",
|
|
1124
|
+
description: "Game and mechanic, e.g. 'super mario 64 triple jump'."
|
|
1125
|
+
},
|
|
1126
|
+
duration: { type: "number", description: "Seconds of gameplay to sample (default 90)." },
|
|
1127
|
+
frames: { type: "number", description: "Frames to slice from the segment (default 12)." },
|
|
1128
|
+
at: { type: "string", description: "Exact timestamps, comma separated, e.g. '12,35,61'." },
|
|
1129
|
+
pick: { type: "number", description: "Search result index (default 0, the top one)." },
|
|
1130
|
+
from: {
|
|
1131
|
+
type: "string",
|
|
1132
|
+
description: "Segment start: seconds, mm:ss or NN% (default 10%)."
|
|
1133
|
+
}
|
|
1134
|
+
},
|
|
1135
|
+
required: ["query"]
|
|
1136
|
+
}
|
|
966
1137
|
}
|
|
967
1138
|
];
|
|
968
1139
|
function toolDefinitions() {
|
|
969
1140
|
return TOOL_DEFINITIONS;
|
|
970
1141
|
}
|
|
971
|
-
var DEFAULT_LOG_FILE =
|
|
1142
|
+
var DEFAULT_LOG_FILE = path.join(".threenative", "engine-mcp.log");
|
|
972
1143
|
var logBroken = false;
|
|
973
1144
|
function logToolCall(entry) {
|
|
974
1145
|
if (logBroken) return;
|
|
975
1146
|
const target = process.env.THREENATIVE_ENGINE_MCP_LOG ?? DEFAULT_LOG_FILE;
|
|
976
1147
|
if (target === "off") return;
|
|
977
1148
|
try {
|
|
978
|
-
mkdirSync(
|
|
1149
|
+
mkdirSync(path.dirname(path.resolve(target)), { recursive: true });
|
|
979
1150
|
appendFileSync(target, `${JSON.stringify({ time: (/* @__PURE__ */ new Date()).toISOString(), ...entry })}
|
|
980
1151
|
`);
|
|
981
1152
|
} catch (error) {
|
|
@@ -995,7 +1166,7 @@ function writeLine(value) {
|
|
|
995
1166
|
`);
|
|
996
1167
|
}
|
|
997
1168
|
function toolText(value) {
|
|
998
|
-
return { content: [{ text: JSON.stringify(value
|
|
1169
|
+
return { content: [{ text: JSON.stringify(value), type: "text" }] };
|
|
999
1170
|
}
|
|
1000
1171
|
async function searchReferences(situation, limit = 5) {
|
|
1001
1172
|
const local = loadLocalReferenceGames();
|
|
@@ -1084,17 +1255,13 @@ async function handleToolCall(params, manifestFile) {
|
|
|
1084
1255
|
tool: name,
|
|
1085
1256
|
verdict: response.verdict
|
|
1086
1257
|
});
|
|
1087
|
-
return toolText(
|
|
1088
|
-
response
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
})
|
|
1095
|
-
)
|
|
1096
|
-
} : response
|
|
1097
|
-
);
|
|
1258
|
+
return toolText({
|
|
1259
|
+
...response,
|
|
1260
|
+
references: await searchReferences(argumentsValue.situation, 3).catch((error) => ({
|
|
1261
|
+
results: [],
|
|
1262
|
+
guidance: `references unavailable: ${String(error)}`
|
|
1263
|
+
}))
|
|
1264
|
+
});
|
|
1098
1265
|
}
|
|
1099
1266
|
if (name === "engine_capability_detail") {
|
|
1100
1267
|
if (typeof argumentsValue.symbol !== "string")
|
|
@@ -1153,6 +1320,27 @@ async function handleToolCall(params, manifestFile) {
|
|
|
1153
1320
|
logToolCall({ tool: name, saved: saved.saved });
|
|
1154
1321
|
return toolText(saved);
|
|
1155
1322
|
}
|
|
1323
|
+
if (name === "engine_watch_reference") {
|
|
1324
|
+
const { query, duration, frames, at, pick, from } = argumentsValue;
|
|
1325
|
+
if (typeof query !== "string" || !query.trim())
|
|
1326
|
+
throw new Error("engine_watch_reference requires a non-empty string 'query'.");
|
|
1327
|
+
for (const [key, value] of Object.entries({ duration, frames, pick }))
|
|
1328
|
+
if (value !== void 0 && typeof value !== "number")
|
|
1329
|
+
throw new Error(`engine_watch_reference '${key}' must be a number when given.`);
|
|
1330
|
+
for (const [key, value] of Object.entries({ at, from }))
|
|
1331
|
+
if (value !== void 0 && typeof value !== "string")
|
|
1332
|
+
throw new Error(`engine_watch_reference '${key}' must be a string when given.`);
|
|
1333
|
+
const result = await watchReference({
|
|
1334
|
+
query,
|
|
1335
|
+
...typeof duration === "number" ? { duration } : {},
|
|
1336
|
+
...typeof frames === "number" ? { frames } : {},
|
|
1337
|
+
...typeof at === "string" ? { at } : {},
|
|
1338
|
+
...typeof pick === "number" ? { pick } : {},
|
|
1339
|
+
...typeof from === "string" ? { from } : {}
|
|
1340
|
+
});
|
|
1341
|
+
logToolCall({ tool: name, query, sheet: result.sheet });
|
|
1342
|
+
return toolText(result);
|
|
1343
|
+
}
|
|
1156
1344
|
throw new Error(`Unknown engine MCP tool '${String(name)}'.`);
|
|
1157
1345
|
}
|
|
1158
1346
|
async function handleLine(line2, manifestFile) {
|
|
@@ -1171,7 +1359,7 @@ async function handleLine(line2, manifestFile) {
|
|
|
1171
1359
|
capabilities: { tools: { listChanged: false } },
|
|
1172
1360
|
instructions: AUTHORING_INSTRUCTIONS,
|
|
1173
1361
|
protocolVersion: "2025-06-18",
|
|
1174
|
-
serverInfo: { name: "threenative-engine-mcp", version: "0.2.
|
|
1362
|
+
serverInfo: { name: "threenative-engine-mcp", version: "0.2.13" }
|
|
1175
1363
|
});
|
|
1176
1364
|
}
|
|
1177
1365
|
if (request.method === "tools/list") {
|
|
@@ -1198,7 +1386,12 @@ async function runCli(argv, manifestFile = defaultManifestPath(), io = {
|
|
|
1198
1386
|
{ arguments: JSON.parse(json), name },
|
|
1199
1387
|
manifestFile
|
|
1200
1388
|
);
|
|
1201
|
-
|
|
1389
|
+
let text2 = result.content[0].text;
|
|
1390
|
+
try {
|
|
1391
|
+
text2 = JSON.stringify(JSON.parse(text2), null, 2);
|
|
1392
|
+
} catch {
|
|
1393
|
+
}
|
|
1394
|
+
io.stdout(`${text2}
|
|
1202
1395
|
`);
|
|
1203
1396
|
return 0;
|
|
1204
1397
|
} catch (error) {
|
|
@@ -1226,7 +1419,7 @@ function runServer(manifestFile = defaultManifestPath()) {
|
|
|
1226
1419
|
});
|
|
1227
1420
|
}
|
|
1228
1421
|
var entryPath = process.argv[1];
|
|
1229
|
-
if (entryPath !== void 0 && realpathSync(
|
|
1422
|
+
if (entryPath !== void 0 && realpathSync(path.resolve(entryPath)) === realpathSync(fileURLToPath(import.meta.url))) {
|
|
1230
1423
|
try {
|
|
1231
1424
|
runServer();
|
|
1232
1425
|
} catch (error) {
|
package/mcp/servers.mjs
CHANGED
|
@@ -24,6 +24,12 @@ export const MCP_SERVERS = Object.freeze({
|
|
|
24
24
|
command: "node",
|
|
25
25
|
args: Object.freeze(["./node_modules/@threenative/core/mcp/engine.mjs"]),
|
|
26
26
|
}),
|
|
27
|
+
// Cooks a starter terrain kit into a world.glb. The server lives in the optional
|
|
28
|
+
// `@threenative/terrain` package, which the shim resolves from the project at launch.
|
|
29
|
+
"threenative-terrain": Object.freeze({
|
|
30
|
+
command: "node",
|
|
31
|
+
args: Object.freeze(["./node_modules/@threenative/core/mcp/terrain.mjs"]),
|
|
32
|
+
}),
|
|
27
33
|
// Inspects, attaches, edits and verifies character animation. Every operation is a build-time
|
|
28
34
|
// edit of one GLB, so a game that animates nothing pays for nothing.
|
|
29
35
|
"threenative-animation": Object.freeze({
|
|
@@ -45,10 +51,11 @@ export const MCP_SERVERS = Object.freeze({
|
|
|
45
51
|
* separately. The pinned engine version remains an emergency fallback for a legacy development
|
|
46
52
|
* checkout whose bundle has not been built. */
|
|
47
53
|
export const MCP_PACKAGES = Object.freeze({
|
|
48
|
-
assets: Object.freeze({ name: "threenative-asset-mcp", version: "0.
|
|
54
|
+
assets: Object.freeze({ name: "threenative-asset-mcp", version: "0.16.0" }),
|
|
55
|
+
terrain: Object.freeze({ name: "@threenative/terrain", version: "0.1.9" }),
|
|
49
56
|
sculpt: Object.freeze({ name: "threenative-sculpt-mcp", version: "0.2.2" }),
|
|
50
|
-
engine: Object.freeze({ name: "threenative-engine-mcp", version: "0.2.
|
|
51
|
-
animation: Object.freeze({ name: "threenative-animation-mcp", version: "0.1.
|
|
57
|
+
engine: Object.freeze({ name: "threenative-engine-mcp", version: "0.2.13" }),
|
|
58
|
+
animation: Object.freeze({ name: "threenative-animation-mcp", version: "0.1.10" }),
|
|
52
59
|
// `args` fixes the launch for every host. The Chrome flags are `WEBGPU_BROWSER_ARGS` from
|
|
53
60
|
// `@threenative/playtest`, so a DevTools trace profiles the same adapter a playtest does and not
|
|
54
61
|
// SwiftShader. An isolated profile keeps the user's own Chrome profile out, and the two opt-outs
|
package/mcp/terrain.mjs
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { launchMcpServer } from "./launch.mjs";
|
|
3
|
+
import { MCP_PACKAGES } from "./servers.mjs";
|
|
4
|
+
|
|
5
|
+
// The terrain server is not bundled here: `@threenative/terrain` already depends on core, so core
|
|
6
|
+
// carrying it would close a dependency cycle through `@threenative/assets`. The shim starts the
|
|
7
|
+
// project's installed `@threenative/terrain` bin and falls back to the pinned version over npx.
|
|
8
|
+
await launchMcpServer(MCP_PACKAGES.terrain);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@threenative/core",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.13",
|
|
4
4
|
"license": "MIT AND GPL-2.0-or-later",
|
|
5
5
|
"description": "The small vanilla Three.js game runtime foundation.",
|
|
6
6
|
"keywords": [
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
},
|
|
20
20
|
"repository": {
|
|
21
21
|
"type": "git",
|
|
22
|
-
"url": "git+https://github.com/ThreeNativeHQ/threenative.git",
|
|
22
|
+
"url": "git+https://github.com/ThreeNativeHQ/threenative-engine.git",
|
|
23
23
|
"directory": "packages/core"
|
|
24
24
|
},
|
|
25
25
|
"type": "module",
|
|
@@ -71,10 +71,22 @@
|
|
|
71
71
|
"types": "./dist/world.d.ts",
|
|
72
72
|
"import": "./dist/world.js"
|
|
73
73
|
},
|
|
74
|
+
"./render/environment": {
|
|
75
|
+
"types": "./dist/render-environment.d.ts",
|
|
76
|
+
"import": "./dist/render-environment.js"
|
|
77
|
+
},
|
|
74
78
|
"./net": {
|
|
75
79
|
"types": "./dist/net.d.ts",
|
|
76
80
|
"import": "./dist/net.js"
|
|
77
81
|
},
|
|
82
|
+
"./spells": {
|
|
83
|
+
"types": "./dist/spells/index.d.ts",
|
|
84
|
+
"import": "./dist/spells/index.js"
|
|
85
|
+
},
|
|
86
|
+
"./spells/ultra": {
|
|
87
|
+
"types": "./dist/spells/ultra/index.d.ts",
|
|
88
|
+
"import": "./dist/spells/ultra/index.js"
|
|
89
|
+
},
|
|
78
90
|
"./package.json": "./package.json"
|
|
79
91
|
},
|
|
80
92
|
"publishConfig": {
|
|
@@ -85,7 +97,7 @@
|
|
|
85
97
|
"chrome-devtools-mcp": "1.11.0",
|
|
86
98
|
"three": "0.187.0",
|
|
87
99
|
"three-mesh-bvh": "0.9.14",
|
|
88
|
-
"threenative-asset-mcp": "0.
|
|
100
|
+
"threenative-asset-mcp": "0.16.0",
|
|
89
101
|
"threenative-sculpt-mcp": "0.2.2",
|
|
90
102
|
"zustand": "5.0.14"
|
|
91
103
|
},
|
|
@@ -99,12 +111,12 @@
|
|
|
99
111
|
"tsup": "8.5.1",
|
|
100
112
|
"typescript": "npm:@typescript/typescript6@6.0.2",
|
|
101
113
|
"@typescript/native": "npm:typescript@7.0.2",
|
|
102
|
-
"threenative
|
|
103
|
-
"threenative-engine-mcp": "0.2.
|
|
104
|
-
"
|
|
114
|
+
"@threenative/playtest": "0.3.13",
|
|
115
|
+
"threenative-engine-mcp": "0.2.13",
|
|
116
|
+
"threenative-animation-mcp": "0.1.10"
|
|
105
117
|
},
|
|
106
118
|
"peerDependencies": {
|
|
107
|
-
"@threenative/playtest": ">=0.3.
|
|
119
|
+
"@threenative/playtest": ">=0.3.13 <0.4.0",
|
|
108
120
|
"react": ">=19.2.0 <20",
|
|
109
121
|
"react-reconciler": ">=0.33.0 <0.34"
|
|
110
122
|
},
|