@threenative/core 0.3.5 → 0.3.8
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 +3 -5
- package/capabilities.json +739 -50
- package/dist/{assets-CqvE429w.d.ts → assets-YUbXa3-Y.d.ts} +101 -2
- package/dist/{canvas-layer-C1-5CviZ.d.ts → canvas-layer-vCtanIeB.d.ts} +1 -1
- package/dist/{game-Bj8G1wmD.d.ts → game-cb99J-YE.d.ts} +112 -31
- package/dist/hot.d.ts +4 -4
- package/dist/hot.js +23 -5
- package/dist/index.d.ts +1742 -29
- package/dist/index.js +22445 -12411
- package/dist/{model-lod-BDAUYgsS.d.ts → model-lod-CTpZ6imz.d.ts} +1 -1
- package/dist/net.js +39 -12
- package/dist/playtest.d.ts +4 -4
- package/dist/playtest.js +59 -10
- package/dist/react-css.js +23 -0
- package/dist/react.d.ts +2 -2
- package/dist/{renderer-9yEo9hPa.d.ts → renderer-rZm0hVqq.d.ts} +178 -5
- package/dist/ui-layer.d.ts +11 -2
- package/dist/ui-layer.js +76 -4
- package/dist/worker.d.ts +36 -0
- package/dist/worker.js +1088 -0
- package/dist/world.d.ts +11 -3
- package/dist/world.js +1117 -197
- package/mcp/animation-server.mjs +265 -0
- package/mcp/animation.mjs +22 -0
- package/mcp/call.mjs +105 -0
- package/mcp/devtools.mjs +5 -0
- package/mcp/engine-server.mjs +713 -37
- package/mcp/launch.mjs +3 -2
- package/mcp/servers.d.mts +2 -0
- package/mcp/servers.mjs +33 -8
- package/package.json +12 -8
- package/patches/three@0.185.1-prd269-upgrade.patch +308 -0
- package/patches/three@0.185.1.patch +481 -272
- package/src/animation-packet-state.ts +88 -0
- package/src/animation-pose-packet.ts +537 -0
- package/src/animation.ts +779 -31
- package/src/asset-cache.ts +719 -0
- package/src/assets.ts +521 -152
- package/src/audio.ts +29 -3
- package/src/auto-batch.ts +792 -0
- package/src/config.ts +2 -0
- package/src/frame-budget.ts +268 -2
- package/src/game.ts +544 -106
- package/src/grounding.ts +7 -6
- package/src/hot.ts +19 -5
- package/src/index.ts +381 -6
- package/src/input.ts +21 -2
- package/src/interpolation.ts +19 -1
- package/src/launch-diagnostics.ts +7 -2
- package/src/look/ao-multibounce.ts +29 -0
- package/src/look/ao-reach.ts +39 -0
- package/src/look/auto-exposure.ts +264 -0
- package/src/look/default-tone-mapping.ts +44 -0
- package/src/look/exposure-graph.ts +208 -0
- package/src/look/exposure-readback.ts +97 -0
- package/src/look/exposure-settings.ts +132 -0
- package/src/look/filmic-tone-mapping.ts +852 -0
- package/src/look/gi-registry.ts +55 -0
- package/src/look/local-exposure.ts +507 -0
- package/src/look/look-diagnostics.ts +24 -0
- package/src/look/motion-blur.ts +42 -0
- package/src/look/quality.ts +309 -0
- package/src/look/reflection-trace.ts +344 -0
- package/src/look/unreal-bloom.ts +295 -0
- package/src/look/vignette.ts +14 -0
- package/src/look/world-environment.ts +2033 -0
- package/src/loop.ts +40 -6
- package/src/merge-parts.ts +25 -10
- package/src/model-lod.ts +14 -0
- package/src/net-session.ts +58 -14
- package/src/ocean/spectral.ts +41 -7
- package/src/picking.ts +72 -5
- package/src/platform.ts +29 -1
- package/src/playtest.ts +69 -12
- package/src/profiling/FrameCounters.ts +166 -5
- package/src/profiling/FrameStages.ts +289 -0
- package/src/profiling/Spans.ts +39 -25
- package/src/profiling/debug-telemetry.ts +312 -0
- package/src/profiling/scene-warning.ts +42 -6
- package/src/projection-apply.ts +11 -3
- package/src/projection-content.ts +189 -0
- package/src/projection-marker.ts +6 -2
- package/src/projection-plan.ts +279 -28
- package/src/projection-skinned.ts +620 -5
- package/src/projection-stability.ts +16 -0
- package/src/projection-uniform.ts +5 -1
- package/src/quiet-markers.ts +56 -0
- package/src/render/budget-ladder.ts +256 -0
- package/src/render/chain.ts +89 -7
- package/src/render/exposure-units.ts +59 -0
- package/src/render/frame-time-budget.ts +162 -0
- package/src/render/gi-budget.ts +231 -0
- package/src/render/gi-visualize.ts +49 -0
- package/src/render/material-key.ts +1 -0
- package/src/render/probe-volume.ts +196 -36
- package/src/render/rough-diffuse.ts +177 -0
- package/src/render/scene-trace.ts +532 -0
- package/src/render/shadow-filter-budget.ts +237 -0
- package/src/render/sky-capture.ts +194 -0
- package/src/render/soft-shadow.ts +607 -0
- package/src/render/surface-cache.ts +418 -0
- package/src/render/traced-reflections.ts +408 -0
- package/src/render/two-sided-foliage.ts +120 -0
- package/src/render/virtual-shadow-pages.ts +112 -12
- package/src/render/virtual-shadow.ts +386 -38
- package/src/render-camera-cull.ts +536 -31
- package/src/render-pass-budget.ts +140 -22
- package/src/renderProjection.ts +65 -9
- package/src/renderer-config.ts +3 -2
- package/src/renderer.ts +289 -14
- package/src/resolution-scaler.ts +65 -7
- package/src/skeletal-mesh.ts +4 -0
- package/src/snow-field.ts +46 -0
- package/src/softbody.ts +6 -5
- package/src/startup-offscreen-bytes.ts +168 -0
- package/src/startup-readiness.ts +137 -2
- package/src/ui-bridge.ts +38 -0
- package/src/ui-hit-regions.ts +6 -2
- package/src/ui-layer.ts +1 -0
- package/src/ui-state.ts +32 -3
- package/src/version.ts +1 -1
- package/src/viewport.ts +8 -5
- package/src/warmup.ts +76 -10
- package/src/worker-audio.ts +579 -0
- package/src/worker.ts +842 -0
- package/src/world-cells.ts +4 -1
- package/gpl/LICENSE.GPL +0 -117
- package/gpl/convert.py +0 -192
- package/gpl/fixtures/make_world_fixture.py +0 -184
- package/gpl/recipes/_common.py +0 -180
- package/gpl/recipes/bake_ao.py +0 -111
- package/gpl/recipes/decimate.py +0 -70
- package/gpl/recipes/export_world.py +0 -699
- package/gpl/recipes/retarget.py +0 -131
- package/gpl/recipes/unwrap.py +0 -71
- package/mcp/blender-server.mjs +0 -689
- package/mcp/blender.mjs +0 -26
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { launchMcpServer } from "./launch.mjs";
|
|
6
|
+
import { MCP_PACKAGES } from "./servers.mjs";
|
|
7
|
+
|
|
8
|
+
// Core carries the built animation server beside this shim, exactly as it carries Blender's, so a
|
|
9
|
+
// project that installed `@threenative/core` has working animation tools with no network and no
|
|
10
|
+
// extra install. It must stay that way for a while: `threenative-animation-mcp` is not published
|
|
11
|
+
// yet, so the npx fallback below cannot work — it is the E404 that made the Blender bundle
|
|
12
|
+
// mandatory, and `mcp-install.spec.ts` holds the same line for this server.
|
|
13
|
+
const localServer = path.resolve(fileURLToPath(import.meta.url), "..", "animation-server.mjs");
|
|
14
|
+
if (existsSync(localServer)) {
|
|
15
|
+
const { runServer } = await import("./animation-server.mjs");
|
|
16
|
+
runServer();
|
|
17
|
+
} else {
|
|
18
|
+
process.stderr.write(
|
|
19
|
+
`TN_MCP_ANIMATION_FALLBACK: no bundled animation server at ${localServer}; fetching ${MCP_PACKAGES.animation.name}@${MCP_PACKAGES.animation.version} over the network instead.\n`,
|
|
20
|
+
);
|
|
21
|
+
await launchMcpServer(MCP_PACKAGES.animation);
|
|
22
|
+
}
|
package/mcp/call.mjs
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Lists or calls the tools of one ThreeNative MCP server without an MCP host.
|
|
3
|
+
// node <game>/node_modules/@threenative/core/mcp/call.mjs servers
|
|
4
|
+
// node <game>/node_modules/@threenative/core/mcp/call.mjs <server> its tools
|
|
5
|
+
// node <game>/node_modules/@threenative/core/mcp/call.mjs <server> <tool> '<json>'
|
|
6
|
+
// A host loads a project's `.mcp.json` only when a session starts in that folder, so an agent that
|
|
7
|
+
// scaffolded the game mid-session has none of its servers (PRD-750: five cold builds, zero engine
|
|
8
|
+
// calls). This starts the server exactly as the host would — the same command, args, env and cwd
|
|
9
|
+
// from that `.mcp.json` — and speaks the stdio protocol for one request.
|
|
10
|
+
import { spawn } from "node:child_process";
|
|
11
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
12
|
+
import path from "node:path";
|
|
13
|
+
import { createInterface } from "node:readline";
|
|
14
|
+
import { fileURLToPath } from "node:url";
|
|
15
|
+
|
|
16
|
+
function projectRoot() {
|
|
17
|
+
let directory = path.dirname(fileURLToPath(import.meta.url));
|
|
18
|
+
while (!existsSync(path.join(directory, ".mcp.json"))) {
|
|
19
|
+
const parent = path.dirname(directory);
|
|
20
|
+
if (parent === directory)
|
|
21
|
+
throw new Error(
|
|
22
|
+
"TN_MCP_CALL_NO_PROJECT: no .mcp.json above this package; run pnpm install in the game.",
|
|
23
|
+
);
|
|
24
|
+
directory = parent;
|
|
25
|
+
}
|
|
26
|
+
return directory;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function request(server, root, method, params) {
|
|
30
|
+
const child = spawn(server.command, server.args ?? [], {
|
|
31
|
+
cwd: root,
|
|
32
|
+
env: { ...process.env, ...server.env },
|
|
33
|
+
stdio: ["pipe", "pipe", "inherit"],
|
|
34
|
+
});
|
|
35
|
+
const send = (message) =>
|
|
36
|
+
child.stdin.write(`${JSON.stringify({ jsonrpc: "2.0", ...message })}\n`);
|
|
37
|
+
return new Promise((resolve, reject) => {
|
|
38
|
+
// Asset downloads and Blender conversions are slow; a hung server still ends the call.
|
|
39
|
+
const timer = setTimeout(
|
|
40
|
+
() => reject(new Error(`TN_MCP_CALL_TIMEOUT: ${method} took over 300 s`)),
|
|
41
|
+
300_000,
|
|
42
|
+
);
|
|
43
|
+
child.on("error", reject);
|
|
44
|
+
child.on("exit", (code) =>
|
|
45
|
+
reject(
|
|
46
|
+
new Error(`TN_MCP_CALL_EXIT: the server exited (${code}) before it answered ${method}`),
|
|
47
|
+
),
|
|
48
|
+
);
|
|
49
|
+
createInterface({ input: child.stdout }).on("line", (line) => {
|
|
50
|
+
// Some servers log to stdout before they speak the protocol.
|
|
51
|
+
if (!line.trim().startsWith("{")) return;
|
|
52
|
+
const message = JSON.parse(line);
|
|
53
|
+
if (message.id === 1) {
|
|
54
|
+
send({ method: "notifications/initialized" });
|
|
55
|
+
send({ id: 2, method, params });
|
|
56
|
+
} else if (message.id === 2) {
|
|
57
|
+
clearTimeout(timer);
|
|
58
|
+
if (message.error) reject(new Error(`${method}: ${message.error.message}`));
|
|
59
|
+
else resolve(message.result);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
send({
|
|
63
|
+
id: 1,
|
|
64
|
+
method: "initialize",
|
|
65
|
+
params: {
|
|
66
|
+
protocolVersion: "2025-06-18",
|
|
67
|
+
capabilities: {},
|
|
68
|
+
clientInfo: { name: "threenative-call", version: "1" },
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
}).finally(() => child.kill());
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const [name, tool, args] = process.argv.slice(2);
|
|
75
|
+
const root = projectRoot();
|
|
76
|
+
const servers = JSON.parse(readFileSync(path.join(root, ".mcp.json"), "utf8")).mcpServers ?? {};
|
|
77
|
+
if (name === undefined) {
|
|
78
|
+
process.stdout.write(`${Object.keys(servers).join("\n")}\n`);
|
|
79
|
+
} else if (servers[name] === undefined) {
|
|
80
|
+
process.stderr.write(
|
|
81
|
+
`TN_MCP_CALL_UNKNOWN_SERVER: ${name}; ${root}/.mcp.json has ${Object.keys(servers).join(", ")}\n`,
|
|
82
|
+
);
|
|
83
|
+
process.exitCode = 2;
|
|
84
|
+
} else {
|
|
85
|
+
try {
|
|
86
|
+
if (tool === undefined) {
|
|
87
|
+
const { tools } = await request(servers[name], root, "tools/list", {});
|
|
88
|
+
for (const { name: toolName, description = "" } of tools)
|
|
89
|
+
process.stdout.write(`${toolName}: ${description.split("\n")[0]}\n`);
|
|
90
|
+
} else {
|
|
91
|
+
const result = await request(servers[name], root, "tools/call", {
|
|
92
|
+
name: tool,
|
|
93
|
+
arguments: JSON.parse(args ?? "{}"),
|
|
94
|
+
});
|
|
95
|
+
const text = (result.content ?? [])
|
|
96
|
+
.filter((item) => item.type === "text")
|
|
97
|
+
.map((item) => item.text);
|
|
98
|
+
process.stdout.write(`${text.length > 0 ? text.join("\n") : JSON.stringify(result)}\n`);
|
|
99
|
+
if (result.isError) process.exitCode = 1;
|
|
100
|
+
}
|
|
101
|
+
} catch (error) {
|
|
102
|
+
process.stderr.write(`${error.message}\n`);
|
|
103
|
+
process.exitCode = 1;
|
|
104
|
+
}
|
|
105
|
+
}
|