{
  "$id": "https://github.com/MarkovWangRR/iso-topology/blob/main/docs/agent/schema/dsl.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "description": "YAML/JSON DSL accepted by isotopo render. Generated for capabilities v0.4.5.",
  "properties": {
    "annotations": {
      "items": {
        "properties": {
          "anchor": {
            "description": "Id of the part the callout points at.",
            "type": "string"
          },
          "bg": {
            "type": "string"
          },
          "border": {
            "type": "string"
          },
          "color": {
            "type": "string"
          },
          "distance": {
            "type": "number"
          },
          "fontSize": {
            "type": "number"
          },
          "side": {
            "enum": [
              "top",
              "right",
              "bottom",
              "left"
            ],
            "type": "string"
          },
          "text": {
            "description": "Multi-line via \\n.",
            "type": "string"
          }
        },
        "required": [
          "anchor",
          "text"
        ],
        "type": "object"
      },
      "type": "array"
    },
    "canvas": {
      "description": "Document-level backdrop (iso ground grid, solid color, etc.)",
      "properties": {
        "background": {
          "description": "Solid background color (CSS color).",
          "type": "string"
        },
        "grid": {
          "description": "Backdrop pattern. iso = diamond rhombus lattice.",
          "enum": [
            "iso",
            "dots",
            "hatch",
            "solid",
            "none"
          ],
          "type": "string"
        },
        "gridColor": {
          "description": "Pattern stroke / dot color.",
          "type": "string"
        },
        "gridStep": {
          "description": "Tile size in world units (default 40).",
          "type": "number"
        }
      },
      "type": "object"
    },
    "nodes": {
      "additionalProperties": {
        "properties": {
          "connectors": {
            "description": "Directed lines between parts (composite only).",
            "items": {
              "properties": {
                "arrow": {
                  "enum": [
                    "none",
                    "triangle"
                  ],
                  "type": "string"
                },
                "from": {
                  "description": "Source part id (or id.anchor for a specific face center).",
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "labelBg": {
                  "type": "string"
                },
                "labelColor": {
                  "type": "string"
                },
                "labelFontFamily": {
                  "description": "Source Sans Pro opts into embedded font resources, measured multiline labels and continuous inline placement. Unknown fonts/scripts remain estimated.",
                  "type": "string"
                },
                "labelFontSize": {
                  "description": "Default 13 in iso, 10 in top.",
                  "type": "number"
                },
                "labelFontWeight": {
                  "description": "Default 600. Embedded font weights: 400, 600, 700; normal and bold aliases.",
                  "type": "string"
                },
                "routing": {
                  "description": "orthogonal bends along iso ground axes (grid-aligned); bezier = soft quadratic arc.",
                  "enum": [
                    "straight",
                    "orthogonal",
                    "orthogonal2",
                    "bezier"
                  ],
                  "type": "string"
                },
                "stroke": {
                  "properties": {
                    "color": {
                      "type": "string"
                    },
                    "dash": {
                      "description": "SVG stroke-dasharray syntax e.g. \"4 3\".",
                      "type": "string"
                    },
                    "width": {
                      "type": "number"
                    }
                  },
                  "type": "object"
                },
                "to": {
                  "description": "Destination part id (same syntax).",
                  "type": "string"
                },
                "waypoints3d": {
                  "description": "Explicit interior XYZ world corners for orthogonal/orthogonal2. Omitted coordinates are absolute zero. A nonempty list overrides waypoints, bend and automatic routing; endpoints remain resolved from from/to.",
                  "items": {
                    "properties": {
                      "wx": {
                        "type": "number"
                      },
                      "wy": {
                        "type": "number"
                      },
                      "wz": {
                        "type": "number"
                      }
                    },
                    "type": "object"
                  },
                  "maxItems": 512,
                  "type": "array"
                }
              },
              "required": [
                "from",
                "to"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "content": {
            "type": "object"
          },
          "geom": {
            "properties": {
              "d": {
                "description": "Iso world Y (depth) extent.",
                "type": "number"
              },
              "h": {
                "description": "Iso world Z (height) extrusion.",
                "type": "number"
              },
              "sides": {
                "description": "Polygon sides (polygon shape only).",
                "type": "integer"
              },
              "w": {
                "description": "Iso world X extent.",
                "type": "number"
              }
            },
            "type": "object"
          },
          "gridStep": {
            "description": "Iso grid step for fossflow-style position: {i, j} placement; also the layout/place cell size.",
            "type": "number"
          },
          "icon": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "layout": {
            "description": "Auto-arrange this container's parts along the iso ground axes — no hand-computed coordinates. On a group, geom.w/d may be omitted (substrate auto-sizes around content).",
            "properties": {
              "align": {
                "description": "Cross-axis alignment within each track (default center).",
                "enum": [
                  "start",
                  "center",
                  "end"
                ],
                "type": "string"
              },
              "cols": {
                "description": "Grid mode only. Default ceil(sqrt(n)).",
                "type": "integer"
              },
              "engine": {
                "description": "v5 — scene-root mode auto only: delegate the arrangement to d2's embedded ELK / dagre engine (offline, deterministic, grid-snapped). Prefer elk for dense DAGs; omit for the built-in solver.",
                "enum": [
                  "elk",
                  "dagre"
                ],
                "type": "string"
              },
              "gap": {
                "description": "Space between children in cells. Default 1.",
                "type": "number"
              },
              "mode": {
                "description": "row = world +x, column = world +y, grid = row-major wrap, ring = first child at the centre with the rest on a circle around it, auto = connector-driven layering of the whole scene (v4.2).",
                "enum": [
                  "row",
                  "column",
                  "grid",
                  "ring",
                  "auto"
                ],
                "type": "string"
              },
              "padding": {
                "description": "Content inset from container edge in cells. Defaults to gap.",
                "type": "number"
              }
            },
            "required": [
              "mode"
            ],
            "type": "object"
          },
          "parts": {
            "description": "Children — only consulted when shape == composite or group.",
            "items": {
              "properties": {
                "content": {
                  "type": "object"
                },
                "geom": {
                  "properties": {
                    "d": {
                      "description": "Iso world Y (depth) extent.",
                      "type": "number"
                    },
                    "h": {
                      "description": "Iso world Z (height) extrusion.",
                      "type": "number"
                    },
                    "sides": {
                      "description": "Polygon sides (polygon shape only).",
                      "type": "integer"
                    },
                    "w": {
                      "description": "Iso world X extent.",
                      "type": "number"
                    }
                  },
                  "type": "object"
                },
                "icon": {
                  "type": "string"
                },
                "id": {
                  "description": "Stable id — referenced by connectors and annotations.",
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "layout": {
                  "description": "Auto-arrange this container's parts along the iso ground axes — no hand-computed coordinates. On a group, geom.w/d may be omitted (substrate auto-sizes around content).",
                  "properties": {
                    "align": {
                      "description": "Cross-axis alignment within each track (default center).",
                      "enum": [
                        "start",
                        "center",
                        "end"
                      ],
                      "type": "string"
                    },
                    "cols": {
                      "description": "Grid mode only. Default ceil(sqrt(n)).",
                      "type": "integer"
                    },
                    "engine": {
                      "description": "v5 — scene-root mode auto only: delegate the arrangement to d2's embedded ELK / dagre engine (offline, deterministic, grid-snapped). Prefer elk for dense DAGs; omit for the built-in solver.",
                      "enum": [
                        "elk",
                        "dagre"
                      ],
                      "type": "string"
                    },
                    "gap": {
                      "description": "Space between children in cells. Default 1.",
                      "type": "number"
                    },
                    "mode": {
                      "description": "row = world +x, column = world +y, grid = row-major wrap, ring = first child at the centre with the rest on a circle around it, auto = connector-driven layering of the whole scene (v4.2).",
                      "enum": [
                        "row",
                        "column",
                        "grid",
                        "ring",
                        "auto"
                      ],
                      "type": "string"
                    },
                    "padding": {
                      "description": "Content inset from container edge in cells. Defaults to gap.",
                      "type": "number"
                    }
                  },
                  "required": [
                    "mode"
                  ],
                  "type": "object"
                },
                "offset": {
                  "properties": {
                    "wx": {
                      "type": "number"
                    },
                    "wy": {
                      "type": "number"
                    },
                    "wz": {
                      "type": "number"
                    }
                  },
                  "type": "object"
                },
                "parts": {
                  "description": "Nested parts — only honored when shape == group.",
                  "type": "array"
                },
                "place": {
                  "description": "Declarative position relative to a SIBLING part — preferred over offset. rightOf/leftOf pin world x, inFrontOf/behind pin world y (front = toward viewer). Chains solve topologically; offset degrades to a fine-tune delta.",
                  "properties": {
                    "above": {
                      "description": "Sibling part id — this part sits flush ON TOP of it (z = its top), centred on its footprint unless x/y are also pinned.",
                      "type": "string"
                    },
                    "align": {
                      "description": "Alignment along the unconstrained axis (default center).",
                      "enum": [
                        "start",
                        "center",
                        "end"
                      ],
                      "type": "string"
                    },
                    "behind": {
                      "description": "Sibling part id — -y side. Mutually exclusive with inFrontOf.",
                      "type": "string"
                    },
                    "gap": {
                      "description": "Distance from the sibling's footprint in CELLS (1 cell = gridStep, default 40 world units). Default 1.",
                      "type": "number"
                    },
                    "gapX": {
                      "description": "Overrides gap on the x axis only.",
                      "type": "number"
                    },
                    "gapY": {
                      "description": "Overrides gap on the y axis only.",
                      "type": "number"
                    },
                    "inFrontOf": {
                      "description": "Sibling part id — +y side (toward viewer).",
                      "type": "string"
                    },
                    "leftOf": {
                      "description": "Sibling part id — -x side. Mutually exclusive with rightOf.",
                      "type": "string"
                    },
                    "rightOf": {
                      "description": "Sibling part id — this part sits on its +x side.",
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "position": {
                  "properties": {
                    "i": {
                      "type": "integer"
                    },
                    "j": {
                      "type": "integer"
                    }
                  },
                  "type": "object"
                },
                "preset": {
                  "description": "Name of a theme.presets entry to merge under this part's style.",
                  "type": "string"
                },
                "shape": {
                  "enum": [
                    "array1d",
                    "array2d",
                    "array3d",
                    "boundary",
                    "c4-person",
                    "c4_person",
                    "callout",
                    "circle",
                    "class",
                    "cloud",
                    "code",
                    "composite",
                    "custom_path",
                    "cylinder",
                    "document",
                    "group",
                    "hexagon",
                    "hexprism",
                    "hierarchy",
                    "image",
                    "iso_text",
                    "octprism",
                    "oval",
                    "package",
                    "page",
                    "person",
                    "queue",
                    "rack",
                    "rectangle",
                    "sequence-diagram",
                    "sequence_diagram",
                    "sql-table",
                    "sql_table",
                    "square",
                    "step",
                    "stored-data",
                    "stored_data",
                    "text",
                    "triprism",
                    "wedge"
                  ],
                  "type": "string"
                },
                "stack": {
                  "properties": {
                    "count": {
                      "description": "Total number of layers.",
                      "minimum": 1,
                      "type": "integer"
                    },
                    "gap": {
                      "description": "World-Z step between layers. Defaults to part.geom.h + 4 if omitted.",
                      "type": "number"
                    }
                  },
                  "required": [
                    "count"
                  ],
                  "type": "object"
                },
                "style": {
                  "description": "Style block (Palette, Stroke, Text, Effects).",
                  "properties": {
                    "effects": {
                      "type": "object"
                    },
                    "palette": {
                      "type": "object"
                    },
                    "stroke": {
                      "type": "object"
                    },
                    "text": {
                      "type": "object"
                    }
                  },
                  "type": "object"
                }
              },
              "required": [
                "shape"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "preset": {
            "description": "Name of a theme.presets entry to merge under this node's style.",
            "type": "string"
          },
          "shape": {
            "description": "One of the iso shapes from capabilities.",
            "enum": [
              "array1d",
              "array2d",
              "array3d",
              "boundary",
              "c4-person",
              "c4_person",
              "callout",
              "circle",
              "class",
              "cloud",
              "code",
              "composite",
              "custom_path",
              "cylinder",
              "document",
              "group",
              "hexagon",
              "hexprism",
              "hierarchy",
              "image",
              "iso_text",
              "octprism",
              "oval",
              "package",
              "page",
              "person",
              "queue",
              "rack",
              "rectangle",
              "sequence-diagram",
              "sequence_diagram",
              "sql-table",
              "sql_table",
              "square",
              "step",
              "stored-data",
              "stored_data",
              "text",
              "triprism",
              "wedge"
            ],
            "type": "string"
          },
          "style": {
            "description": "Style block (Palette, Stroke, Text, Effects).",
            "properties": {
              "effects": {
                "type": "object"
              },
              "palette": {
                "type": "object"
              },
              "stroke": {
                "type": "object"
              },
              "text": {
                "type": "object"
              }
            },
            "type": "object"
          }
        },
        "required": [
          "shape"
        ],
        "type": "object"
      },
      "description": "Map of node id → Node. The 'scene' node (or the single node if there's only one) is treated as the topology root and picks up Canvas + Annotations.",
      "type": "object"
    },
    "theme": {
      "description": "Document-wide default Style plus optional per-shape-type overrides.",
      "properties": {
        "effects": {
          "description": "Visual modifiers. dropShadow {dx, dy, blur, color}; backglow {color, radius, opacity}; pattern {kind, color, spacing, angle}; wireframe (bool, line-art); grain {intensity, scale} (film-grain noise); faceSplit (bool — rounded boxes only: shade left/right faces independently, needs cornerRadius\u003e0).",
          "properties": {
            "backglow": {
              "description": "see reference/dsl-theme.md"
            },
            "cornerRadius": {
              "description": "see reference/dsl-theme.md"
            },
            "dropShadow": {
              "description": "see reference/dsl-theme.md"
            },
            "faceSplit": {
              "description": "see reference/dsl-theme.md"
            },
            "grain": {
              "description": "see reference/dsl-theme.md"
            },
            "margin": {
              "description": "see reference/dsl-theme.md"
            },
            "opacity": {
              "description": "see reference/dsl-theme.md"
            },
            "pattern": {
              "description": "see reference/dsl-theme.md"
            },
            "wireframe": {
              "description": "see reference/dsl-theme.md"
            }
          },
          "type": "object"
        },
        "palette": {
          "description": "Face fills (top/left/right), each optionally a {from, to, dir} gradient via topGradient/leftGradient/rightGradient.",
          "properties": {
            "left": {
              "description": "see reference/dsl-theme.md"
            },
            "leftGradient": {
              "description": "see reference/dsl-theme.md"
            },
            "right": {
              "description": "see reference/dsl-theme.md"
            },
            "rightGradient": {
              "description": "see reference/dsl-theme.md"
            },
            "top": {
              "description": "see reference/dsl-theme.md"
            },
            "topGradient": {
              "description": "see reference/dsl-theme.md"
            }
          },
          "type": "object"
        },
        "presets": {
          "additionalProperties": {
            "description": "Style block (Palette, Stroke, Text, Effects).",
            "properties": {
              "effects": {
                "type": "object"
              },
              "palette": {
                "type": "object"
              },
              "stroke": {
                "type": "object"
              },
              "text": {
                "type": "object"
              }
            },
            "type": "object"
          },
          "description": "Named design-system style presets. Parts reference them with `preset: \u003cname\u003e`; the preset merges between per-shape defaults and the part's own style.",
          "type": "object"
        },
        "shapes": {
          "additionalProperties": {
            "description": "Style block (Palette, Stroke, Text, Effects).",
            "properties": {
              "effects": {
                "type": "object"
              },
              "palette": {
                "type": "object"
              },
              "stroke": {
                "type": "object"
              },
              "text": {
                "type": "object"
              }
            },
            "type": "object"
          },
          "description": "Per-shape-type Style overrides. Keys are iso shape names (rectangle, cylinder, …).",
          "type": "object"
        },
        "stroke": {
          "description": "Silhouette stroke.",
          "properties": {
            "color": {
              "description": "see reference/dsl-theme.md"
            },
            "dash": {
              "description": "see reference/dsl-theme.md"
            },
            "width": {
              "description": "see reference/dsl-theme.md"
            }
          },
          "type": "object"
        },
        "text": {
          "description": "Label typography.",
          "properties": {
            "boxBg": {
              "description": "see reference/dsl-theme.md"
            },
            "boxBorder": {
              "description": "see reference/dsl-theme.md"
            },
            "color": {
              "description": "see reference/dsl-theme.md"
            },
            "family": {
              "description": "see reference/dsl-theme.md"
            },
            "orient": {
              "description": "see reference/dsl-theme.md"
            },
            "size": {
              "description": "see reference/dsl-theme.md"
            },
            "weight": {
              "description": "see reference/dsl-theme.md"
            }
          },
          "type": "object"
        }
      },
      "type": "object"
    }
  },
  "required": [
    "nodes"
  ],
  "title": "iso-topology Document",
  "type": "object"
}
