Merge pull request #326 from jelharou/fix/mcp-templates-site-children-string-ids
fix(mcp): templates use string IDs for SiteNode.children
This commit is contained in:
@@ -238,16 +238,6 @@ function buildTemplate(): SceneGraph {
|
||||
nodes[node.id as AnyNodeId] = node
|
||||
}
|
||||
|
||||
// SiteNode.children is a discriminatedUnion of BuildingNode/ItemNode objects
|
||||
// (not string ids) — so the site must embed the full building node. The
|
||||
// rest of the tree uses string ids per the BaseNode/LevelNode/WallNode
|
||||
// schemas. We mutate the flat-dict copy of the site here so the nested
|
||||
// representation round-trips through AnyNode.safeParse.
|
||||
const siteInDict = nodes['site_empty' as AnyNodeId] as unknown as {
|
||||
children: unknown[]
|
||||
}
|
||||
siteInDict.children = [nodes['building_empty' as AnyNodeId]]
|
||||
|
||||
return {
|
||||
nodes,
|
||||
rootNodeIds: ['site_empty'] as AnyNodeId[],
|
||||
|
||||
@@ -263,10 +263,6 @@ function buildTemplate(): SceneGraph {
|
||||
],
|
||||
} as unknown as AnyNode
|
||||
|
||||
// SiteNode.children is a discriminatedUnion of BuildingNode/ItemNode objects
|
||||
// (not string ids) per the schema — embed the full building node here.
|
||||
;(nodes.site_garden as unknown as { children: unknown[] }).children = [nodes.building_garden!]
|
||||
|
||||
return {
|
||||
nodes: nodes as Record<AnyNodeId, AnyNode>,
|
||||
rootNodeIds: ['site_garden'] as AnyNodeId[],
|
||||
|
||||
@@ -291,10 +291,6 @@ function buildTemplate(): SceneGraph {
|
||||
],
|
||||
} as unknown as AnyNode
|
||||
|
||||
// SiteNode.children is a discriminatedUnion of BuildingNode/ItemNode objects
|
||||
// (not string ids) per the schema — embed the full building node here.
|
||||
;(nodes.site_2br as unknown as { children: unknown[] }).children = [nodes.building_2br!]
|
||||
|
||||
return {
|
||||
nodes: nodes as Record<AnyNodeId, AnyNode>,
|
||||
rootNodeIds: ['site_2br'] as AnyNodeId[],
|
||||
|
||||
Reference in New Issue
Block a user