@babylonjs/mcp-servers 9.15.0 → 9.16.1
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/dist/gui-mcp-server.js +1 -1
- package/dist/gui-mcp-server.js.map +1 -1
- package/dist/nge-mcp-server.js +1 -1
- package/dist/nge-mcp-server.js.map +1 -1
- package/dist/nme-mcp-server.js +1 -1
- package/dist/nme-mcp-server.js.map +1 -1
- package/dist/npe-mcp-server.js +1 -1
- package/dist/npe-mcp-server.js.map +1 -1
- package/dist/nrge-mcp-server.js +1 -1
- package/dist/nrge-mcp-server.js.map +1 -1
- package/package.json +2 -2
package/dist/npe-mcp-server.js
CHANGED
|
@@ -97,7 +97,7 @@ data: ${JSON.stringify({reason:r})}
|
|
|
97
97
|
Inputs:`);for(const u of n.inputs){const l=u.targetBlockId!==void 0?` \u2190 connected to [${u.targetBlockId}].${u.targetConnectionName}`:" (unconnected)";a.push(` \u2022 ${u.name}${l}`)}a.push(`
|
|
98
98
|
Outputs:`);for(const u of n.outputs){const l=[];for(const m of i.blocks)for(const p of m.inputs)p.targetBlockId===r&&p.targetConnectionName===u.name&&l.push(`[${m.id}] ${m.name}.${p.name}`);const d=l.length>0?` \u2192 ${l.join(", ")}`:" (unconnected)";a.push(` \u2022 ${u.name}${d}`)}const s=new Set(["customType","id","name","inputs","outputs"]),c=Object.entries(n).filter(([u])=>!s.has(u));if(c.length>0){a.push(`
|
|
99
99
|
Properties:`);for(const[u,l]of c)a.push(` ${u}: ${JSON.stringify(l)}`)}return a.join(`
|
|
100
|
-
`)}exportJSON(t){const r=this._particleSets.get(t);if(r){for(const i of r.blocks){i.customType==="BABYLON.ParticleInputBlock"&&(this._normaliseInputBlockValue(i),this._ensureDefaultValue(i));const n=i.customType.replace("BABYLON.",""),o=zn[n];if(o?.defaultSerializedProperties)for(const[s,c]of Object.entries(o.defaultSerializedProperties))i[s]===void 0&&(i[s]=c);const a=zr[n];if(a)for(const[s,c]of Object.entries(a))typeof i[s]=="string"&&(i[s]=c[i[s]]??i[s])}return this._layoutGraph(r),JSON.stringify(r,null,2)}}static COL_WIDTH=340;static ROW_HEIGHT=180;_layoutGraph(t){const r=t.blocks;if(r.length===0)return;const i=new Map;for(const g of r)i.set(g.id,g);const n=new Map,o=new Map;for(const g of r)n.set(g.id,new Set),o.set(g.id,new Set);for(const g of r)for(const v of g.inputs)v.targetBlockId!==void 0&&(n.get(g.id).add(v.targetBlockId),o.get(v.targetBlockId)?.add(g.id));const a=new Map,s=[];for(const g of r)g.customType==="BABYLON.SystemBlock"&&(a.set(g.id,0),s.push(g.id));s.length===0&&r.length>0&&(a.set(r[r.length-1].id,0),s.push(r[r.length-1].id));let c=0;for(;c<s.length;){const g=s[c++],v=a.get(g);for(const y of n.get(g)??[]){const b=a.get(y);(b===void 0||v+1>b)&&(a.set(y,v+1),s.push(y))}}const u=Math.max(0,...a.values());for(const g of r)a.has(g.id)||a.set(g.id,u+1);const l=Math.max(0,...a.values()),d=new Map;for(const[g,v]of a)d.set(g,l-v);const m=new Map;for(const g of r){const v=d.get(g.id);m.has(v)||m.set(v,[]),m.get(v).push(g.id)}const p=[...m.keys()].sort((g,v)=>v-g),h=new Map;for(const g of p){const v=m.get(g);if(g===p[0])v.forEach((y,b)=>h.set(y,b));else{const y=new Map;for(const b of v){const I=o.get(b),O=[];for(const M of I){const V=h.get(M);V!==void 0&&O.push(V)}O.length>0?y.set(b,O.reduce((M,V)=>M+V,0)/O.length):y.set(b,9999)}v.sort((b,I)=>y.get(b)-y.get(I)),v.forEach((b,I)=>h.set(b,I))}}const $=[];for(const g of r){const v=d.get(g.id),y=h.get(g.id);$.push({blockId:g.id,x:v*So.COL_WIDTH,y:y*So.ROW_HEIGHT})}t.editorData?t.editorData.locations=$:t.editorData={locations:$}}importJSON(t,r){try{const i=JSON.parse(r);this._particleSets.set(t,i);const n=i.blocks.reduce((o,a)=>Math.max(o,a.id),0);return this._nextId.set(t,n+1),this._nextX.set(t,i.blocks.length*280),"OK"}catch(i){return`Failed to parse JSON: ${i.message}`}}setBlockProperties(t,r,i){const n=this._particleSets.get(t);if(!n)return`Particle set "${t}" not found.`;const o=n.blocks.find(s=>s.id===r);if(!o)return`Block ${r} not found.`;const a=o.customType.replace("BABYLON.","");for(const[s,c]of Object.entries(i))if(a==="ParticleInputBlock"&&s==="type"&&typeof c=="string")o.type=ce[c]??c;else if(a==="ParticleInputBlock"&&s==="contextualValue"&&typeof c=="string"){const u=ve[c]??c;o.contextualValue=u,o.systemSource=Ke.None,typeof u=="number"&&u!==ve.None&&$o[u]!==void 0&&(o.type=$o[u])}else if(a==="ParticleInputBlock"&&s==="systemSource"&&typeof c=="string"){const u=Ke[c]??c;o.systemSource=u,o.contextualValue=ve.None,typeof u=="number"&&u!==Ke.None&&bo[u]!==void 0&&(o.type=bo[u])}else typeof c=="string"&&zr[a]?.[s]?o[s]=zr[a][s][c]??c:o[s]=c;return a==="ParticleInputBlock"&&(this._normaliseInputBlockValue(o),this._ensureDefaultValue(o)),"OK"}validateParticleSet(t){const r=this._particleSets.get(t);if(!r)return[`Particle set "${t}" not found.`];const i=[];r.blocks.some(o=>o.customType==="BABYLON.SystemBlock")||i.push("ERROR: Missing SystemBlock \u2014 every particle graph needs at least one SystemBlock to produce a particle system.");for(const o of r.blocks){const a=o.customType.replace("BABYLON.",""),s=Object.values(zn).find(c=>c.className===a);if(s)for(const c of o.inputs){const u=s.inputs.find(l=>l.name===c.name);c.targetBlockId===void 0&&u&&!u.isOptional&&i.push(`ERROR: Block [${o.id}] "${o.name}" has required input "${c.name}" that is not connected.`)}}for(const o of r.blocks)for(const a of o.inputs)if(a.targetBlockId!==void 0){const s=r.blocks.find(c=>c.id===a.targetBlockId);s?s.outputs.find(c=>c.name===a.targetConnectionName)||i.push(`WARNING: Block [${o.id}] "${o.name}" input "${a.name}" references output "${a.targetConnectionName}" which doesn't exist on block [${s.id}].`):i.push(`ERROR: Block [${o.id}] "${o.name}" input "${a.name}" references non-existent block ${a.targetBlockId}.`)}for(const o of r.blocks){if(o.customType!=="BABYLON.ParticleInputBlock")continue;const a=o.contextualValue,s=o.systemSource,c=o.value!==void 0;(a===void 0||a===ve.None)&&(s===void 0||s===Ke.None)&&!c&&i.push(`WARNING: ParticleInputBlock [${o.id}] "${o.name}" has no contextual value, no system source, and no constant value \u2014 it provides no data.`)}for(const o of r.blocks){if(o.customType==="BABYLON.SystemBlock"||o.customType==="BABYLON.ParticleInputBlock")continue;const a=o.inputs.some(c=>c.targetBlockId!==void 0),s=r.blocks.some(c=>c.inputs.some(u=>u.targetBlockId===o.id));!a&&!s&&i.push(`WARNING: Block [${o.id}] "${o.name}" (${o.customType.replace("BABYLON.","")}) has no connections \u2014 it is an orphan and does nothing.`)}return i.length===0&&i.push("No issues found \u2014 graph looks valid."),i}}const Kx="https://cdn.babylonjs.com",Gx={havok:"havok/HavokPhysics_umd.js",ammo:"ammo/ammo.js",recast:"recast.js"},ou="https://snippet.babylonjs.com";async function Wx(e,t=ou){let r=e.replace(/#/g,"/");r.includes("/")||(r+="/0");const i=`${t}/${r}`,n=await fetch(i);if(!n.ok)throw new Error(`Failed to fetch snippet "${e}": ${n.status} ${n.statusText}`);return await n.json()}const Yx=[["nodeMaterial","nodeMaterial"],["nodeGeometry","nodeGeometry"],["nodeRenderGraph","nodeRenderGraph"],["nodeParticle","nodeParticle"],["gui","gui"],["encodedGui","gui"],["animations","animation"],["animation","animation"],["particleSystem","particleSystem"],["spriteManager","spriteManager"],["shaderMaterial","shaderMaterial"]];function Xx(e){const t=atob(e),r=new Uint8Array(t.length);for(let i=0;i<t.length;i++)r[i]=t.charCodeAt(i);return r.buffer}function zv(e){const t=new Uint8Array(Xx(e));return new TextDecoder("utf-8").decode(t)}function Qx(e){if(e.files&&typeof e.files=="object"&&e.v!==void 0||typeof e.code=="string")return"playground";for(const[t,r]of Yx)if(t in e)return r;return"unknown"}function eT(e,t,r,i){let n;switch(t){case"gui":{typeof e.encodedGui=="string"?n=JSON.parse(zv(e.encodedGui)):n=typeof e.gui=="string"?JSON.parse(e.gui):e.gui;break}case"animation":{typeof e.animations=="string"?n=JSON.parse(e.animations):e.animations!==void 0?n=e.animations:typeof e.animation=="string"?n=JSON.parse(e.animation):n=e.animation;break}default:{const a=e[t];n=typeof a=="string"?JSON.parse(a):a;break}}return{snippetId:r,type:t,metadata:i,data:n,load:o=>o?o(n):n}}let au=null;async function tT(){return await import("monaco-editor/esm/vs/language/typescript/lib/typescriptServices")}async function nT(){return au||(au=tT().then(e=>e.typescript)),await au}async function rT(e,t){const r=await nT();return r.transpileModule(e,{compilerOptions:{target:r.ScriptTarget.ESNext,module:r.ModuleKind.ESNext,jsx:t.endsWith(".tsx")?r.JsxEmit.ReactJSX:void 0,esModuleInterop:!1,allowJs:!0,sourceMap:!1,
|
|
100
|
+
`)}exportJSON(t){const r=this._particleSets.get(t);if(r){for(const i of r.blocks){i.customType==="BABYLON.ParticleInputBlock"&&(this._normaliseInputBlockValue(i),this._ensureDefaultValue(i));const n=i.customType.replace("BABYLON.",""),o=zn[n];if(o?.defaultSerializedProperties)for(const[s,c]of Object.entries(o.defaultSerializedProperties))i[s]===void 0&&(i[s]=c);const a=zr[n];if(a)for(const[s,c]of Object.entries(a))typeof i[s]=="string"&&(i[s]=c[i[s]]??i[s])}return this._layoutGraph(r),JSON.stringify(r,null,2)}}static COL_WIDTH=340;static ROW_HEIGHT=180;_layoutGraph(t){const r=t.blocks;if(r.length===0)return;const i=new Map;for(const g of r)i.set(g.id,g);const n=new Map,o=new Map;for(const g of r)n.set(g.id,new Set),o.set(g.id,new Set);for(const g of r)for(const v of g.inputs)v.targetBlockId!==void 0&&(n.get(g.id).add(v.targetBlockId),o.get(v.targetBlockId)?.add(g.id));const a=new Map,s=[];for(const g of r)g.customType==="BABYLON.SystemBlock"&&(a.set(g.id,0),s.push(g.id));s.length===0&&r.length>0&&(a.set(r[r.length-1].id,0),s.push(r[r.length-1].id));let c=0;for(;c<s.length;){const g=s[c++],v=a.get(g);for(const y of n.get(g)??[]){const b=a.get(y);(b===void 0||v+1>b)&&(a.set(y,v+1),s.push(y))}}const u=Math.max(0,...a.values());for(const g of r)a.has(g.id)||a.set(g.id,u+1);const l=Math.max(0,...a.values()),d=new Map;for(const[g,v]of a)d.set(g,l-v);const m=new Map;for(const g of r){const v=d.get(g.id);m.has(v)||m.set(v,[]),m.get(v).push(g.id)}const p=[...m.keys()].sort((g,v)=>v-g),h=new Map;for(const g of p){const v=m.get(g);if(g===p[0])v.forEach((y,b)=>h.set(y,b));else{const y=new Map;for(const b of v){const I=o.get(b),O=[];for(const M of I){const V=h.get(M);V!==void 0&&O.push(V)}O.length>0?y.set(b,O.reduce((M,V)=>M+V,0)/O.length):y.set(b,9999)}v.sort((b,I)=>y.get(b)-y.get(I)),v.forEach((b,I)=>h.set(b,I))}}const $=[];for(const g of r){const v=d.get(g.id),y=h.get(g.id);$.push({blockId:g.id,x:v*So.COL_WIDTH,y:y*So.ROW_HEIGHT})}t.editorData?t.editorData.locations=$:t.editorData={locations:$}}importJSON(t,r){try{const i=JSON.parse(r);this._particleSets.set(t,i);const n=i.blocks.reduce((o,a)=>Math.max(o,a.id),0);return this._nextId.set(t,n+1),this._nextX.set(t,i.blocks.length*280),"OK"}catch(i){return`Failed to parse JSON: ${i.message}`}}setBlockProperties(t,r,i){const n=this._particleSets.get(t);if(!n)return`Particle set "${t}" not found.`;const o=n.blocks.find(s=>s.id===r);if(!o)return`Block ${r} not found.`;const a=o.customType.replace("BABYLON.","");for(const[s,c]of Object.entries(i))if(a==="ParticleInputBlock"&&s==="type"&&typeof c=="string")o.type=ce[c]??c;else if(a==="ParticleInputBlock"&&s==="contextualValue"&&typeof c=="string"){const u=ve[c]??c;o.contextualValue=u,o.systemSource=Ke.None,typeof u=="number"&&u!==ve.None&&$o[u]!==void 0&&(o.type=$o[u])}else if(a==="ParticleInputBlock"&&s==="systemSource"&&typeof c=="string"){const u=Ke[c]??c;o.systemSource=u,o.contextualValue=ve.None,typeof u=="number"&&u!==Ke.None&&bo[u]!==void 0&&(o.type=bo[u])}else typeof c=="string"&&zr[a]?.[s]?o[s]=zr[a][s][c]??c:o[s]=c;return a==="ParticleInputBlock"&&(this._normaliseInputBlockValue(o),this._ensureDefaultValue(o)),"OK"}validateParticleSet(t){const r=this._particleSets.get(t);if(!r)return[`Particle set "${t}" not found.`];const i=[];r.blocks.some(o=>o.customType==="BABYLON.SystemBlock")||i.push("ERROR: Missing SystemBlock \u2014 every particle graph needs at least one SystemBlock to produce a particle system.");for(const o of r.blocks){const a=o.customType.replace("BABYLON.",""),s=Object.values(zn).find(c=>c.className===a);if(s)for(const c of o.inputs){const u=s.inputs.find(l=>l.name===c.name);c.targetBlockId===void 0&&u&&!u.isOptional&&i.push(`ERROR: Block [${o.id}] "${o.name}" has required input "${c.name}" that is not connected.`)}}for(const o of r.blocks)for(const a of o.inputs)if(a.targetBlockId!==void 0){const s=r.blocks.find(c=>c.id===a.targetBlockId);s?s.outputs.find(c=>c.name===a.targetConnectionName)||i.push(`WARNING: Block [${o.id}] "${o.name}" input "${a.name}" references output "${a.targetConnectionName}" which doesn't exist on block [${s.id}].`):i.push(`ERROR: Block [${o.id}] "${o.name}" input "${a.name}" references non-existent block ${a.targetBlockId}.`)}for(const o of r.blocks){if(o.customType!=="BABYLON.ParticleInputBlock")continue;const a=o.contextualValue,s=o.systemSource,c=o.value!==void 0;(a===void 0||a===ve.None)&&(s===void 0||s===Ke.None)&&!c&&i.push(`WARNING: ParticleInputBlock [${o.id}] "${o.name}" has no contextual value, no system source, and no constant value \u2014 it provides no data.`)}for(const o of r.blocks){if(o.customType==="BABYLON.SystemBlock"||o.customType==="BABYLON.ParticleInputBlock")continue;const a=o.inputs.some(c=>c.targetBlockId!==void 0),s=r.blocks.some(c=>c.inputs.some(u=>u.targetBlockId===o.id));!a&&!s&&i.push(`WARNING: Block [${o.id}] "${o.name}" (${o.customType.replace("BABYLON.","")}) has no connections \u2014 it is an orphan and does nothing.`)}return i.length===0&&i.push("No issues found \u2014 graph looks valid."),i}}const Kx="https://cdn.babylonjs.com",Gx={havok:"havok/HavokPhysics_umd.js",ammo:"ammo/ammo.js",recast:"recast.js"},ou="https://snippet.babylonjs.com";async function Wx(e,t=ou){let r=e.replace(/#/g,"/");r.includes("/")||(r+="/0");const i=`${t}/${r}`,n=await fetch(i);if(!n.ok)throw new Error(`Failed to fetch snippet "${e}": ${n.status} ${n.statusText}`);return await n.json()}const Yx=[["nodeMaterial","nodeMaterial"],["nodeGeometry","nodeGeometry"],["nodeRenderGraph","nodeRenderGraph"],["nodeParticle","nodeParticle"],["gui","gui"],["encodedGui","gui"],["animations","animation"],["animation","animation"],["particleSystem","particleSystem"],["spriteManager","spriteManager"],["shaderMaterial","shaderMaterial"]];function Xx(e){const t=atob(e),r=new Uint8Array(t.length);for(let i=0;i<t.length;i++)r[i]=t.charCodeAt(i);return r.buffer}function zv(e){const t=new Uint8Array(Xx(e));return new TextDecoder("utf-8").decode(t)}function Qx(e){if(e.files&&typeof e.files=="object"&&e.v!==void 0||typeof e.code=="string")return"playground";for(const[t,r]of Yx)if(t in e)return r;return"unknown"}function eT(e,t,r,i){let n;switch(t){case"gui":{typeof e.encodedGui=="string"?n=JSON.parse(zv(e.encodedGui)):n=typeof e.gui=="string"?JSON.parse(e.gui):e.gui;break}case"animation":{typeof e.animations=="string"?n=JSON.parse(e.animations):e.animations!==void 0?n=e.animations:typeof e.animation=="string"?n=JSON.parse(e.animation):n=e.animation;break}default:{const a=e[t];n=typeof a=="string"?JSON.parse(a):a;break}}return{snippetId:r,type:t,metadata:i,data:n,load:o=>o?o(n):n}}let au=null;async function tT(){return await import("monaco-editor/esm/vs/language/typescript/lib/typescriptServices")}async function nT(){return au||(au=tT().then(e=>e.typescript)),await au}async function rT(e,t){const r=await nT();return r.transpileModule(e,{compilerOptions:{target:r.ScriptTarget.ESNext,module:r.ModuleKind.ESNext,jsx:t.endsWith(".tsx")?r.JsxEmit.ReactJSX:void 0,esModuleInterop:!1,allowJs:!0,sourceMap:!1,isolatedModules:!0,strict:!1,allowUmdGlobalAccess:!0},fileName:t}).outputText}async function iT(e,t){const r={},i=[];for(const[n,o]of Object.entries(e))if(/\.tsx?$/i.test(n)){const a=n.replace(/\.tsx?$/i,".js");i.push((async()=>{r[a]=await Promise.resolve(t(o,n))})())}else r[n]=o;return await Promise.all(i),r}const Ev=["delayCreateScene","delayLoadScene","createScene","CreateScene","createscene"];function oT(e){if(e.includes("class Playground"))return"TS";if(Ev.some(i=>e.includes(i))||!e)return"JS";const t=[/\binterface\s+[A-Za-z_]\w*/m,/\benum\s+[A-Za-z_]\w*/m,/\btype\s+[A-Za-z_]\w*\s*=/m,/\bimplements\s+[A-Za-z_]/m,/\breadonly\b/m,/\bpublic\b|\bprivate\b|\bprotected\b/m,/\babstract\s+class\b/m,/\bas\s+const\b/m,/\bimport\s+type\s+/m],r=/[:]\s*[A-Za-z_$][\w$.<>,\s?\\[\]|&]*\b(?![:=])/m.test(e);return t.some(i=>i.test(e))||r?"TS":"JS"}function aT(e,t){let r=e;if(t==="JS"){const n=r.search(/(?:var|let|const|function)\s+(?:createScene|delayCreateScene|delayLoadScene|createEngine|CreateScene)\b/),o=n>0?r.slice(0,n):"";o&&(r=o.replace(/^[^\S\n]*(?:var|let|const)\s+canvas\s*=\s*document\.getElementById\s*\([^)]*\)\s*;?[^\S\n]*$/gm,"// [snippet-loader] canvas provided by host").replace(/^[^\S\n]*(?:var|let|const)\s+engine\s*=\s*new\s+BABYLON\.\w*Engine\b[^;]*;?[^\S\n]*$/gm,"// [snippet-loader] engine provided by host")+r.slice(n))}const i=t==="TS"?"Playground":Ev.find(n=>r.includes(n))??"createScene";return r+=`
|
|
101
101
|
export default ${i}
|
|
102
102
|
`,t==="JS"&&/\bfunction\s+createEngine\b|\bvar\s+createEngine\s*=|\bconst\s+createEngine\s*=|\blet\s+createEngine\s*=/.test(r)&&(r+=`
|
|
103
103
|
export { createEngine }
|