1import { ENGINE_IDS, type EngineId, type EngineRuntime } from '../../shared/engines'2import { normalizationFor, type NormalizationCapability } from '../../../shared/svg/index.js'34export interface EngineCatalogEntry {5 id: EngineId6 targetRuntime: EngineRuntime7 activeRuntime: EngineRuntime8 version: string9 knownLosses: readonly string[]10 normalization: NormalizationCapability11}1213const targetRuntime: Record<EngineId, EngineRuntime> = {14 plantuml: 'edge-wasm',15 mermaid: 'browser-run',16 graphviz: 'edge-wasm',17 d2: 'edge-wasm',18 c4plantuml: 'edge-wasm',19 blockdiag: 'edge-python',20 seqdiag: 'edge-python',21 actdiag: 'edge-python',22 nwdiag: 'edge-python',23 packetdiag: 'edge-python',24 rackdiag: 'edge-python',25 squaring: 'edge-js',26 bpmn: 'edge-js',27 bytefield: 'edge-js',28 dbml: 'edge-wasm',29 diagramsnet: 'browser-run',30 ditaa: 'edge-wasm',31 erd: 'edge-wasm',32 excalidraw: 'edge-js',33 goat: 'edge-wasm',34 nomnoml: 'edge-js',35 pikchr: 'edge-wasm',36 structurizr: 'edge-js',37 svgbob: 'edge-wasm',38 symbolator: 'edge-python',39 tikz: 'edge-wasm',40 trn: 'edge-js',41 umlet: 'edge-js',42 vega: 'edge-js',43 vegalite: 'edge-js',44 wavedrom: 'edge-js',45 wireviz: 'edge-python',46}4748const activeRuntime: Record<EngineId, EngineRuntime> = {49 plantuml: 'edge-wasm',50 c4plantuml: 'edge-wasm',51 mermaid: 'browser-run',52 bpmn: 'edge-js',53 bytefield: 'edge-js',54 diagramsnet: 'browser-run',55 excalidraw: 'edge-js',56 nomnoml: 'edge-js',57 vega: 'edge-js',58 vegalite: 'edge-js',59 wavedrom: 'edge-js',60 blockdiag: 'edge-python',61 seqdiag: 'edge-python',62 actdiag: 'edge-python',63 nwdiag: 'edge-python',64 packetdiag: 'edge-python',65 rackdiag: 'edge-python',66 squaring: 'edge-js',67 graphviz: 'edge-wasm',68 dbml: 'edge-wasm',69 pikchr: 'edge-wasm',70 svgbob: 'edge-wasm',71 goat: 'edge-wasm',72 erd: 'edge-wasm',73 wireviz: 'edge-python',74 structurizr: 'edge-js',75 d2: 'edge-wasm',76 ditaa: 'edge-wasm',77 symbolator: 'edge-python',78 tikz: 'edge-wasm',79 trn: 'edge-js',80 umlet: 'edge-js',81}8283const versions: Record<EngineId, string> = {84 plantuml: 'plantuml@1.2026.6/edge-wasm-1',85 c4plantuml: 'c4plantuml@2.7.0-lowered+plantuml@1.2026.6/edge-wasm-1',86 mermaid: 'mermaid@11.17.0',87 bpmn: 'diagramzip-bpmn-svg@1',88 diagramsnet: 'diagrams.net@29.6.1',89 bytefield: 'bytefield-svg@1.11.0',90 excalidraw: '@excalidraw/excalidraw@0.18.1',91 nomnoml: 'nomnoml@1.7.0',92 vega: 'vega@6.3.1',93 vegalite: 'vega-lite@6.4.3',94 wavedrom: 'wavedrom@3.6.2',95 blockdiag: 'blockdiag@3.4.2/python-worker-1',96 seqdiag: 'seqdiag@3.0.0/python-worker-1',97 actdiag: 'actdiag@3.0.0/python-worker-1',98 nwdiag: 'nwdiag@3.0.0/python-worker-1',99 packetdiag: 'packetdiag@3.0.0/python-worker-1',100 rackdiag: 'rackdiag@3.0.0/python-worker-1',101 squaring: 'diagramzip-squaring@3',102 graphviz: 'graphviz@15.1.1/edge-wasm-2',103 dbml: 'dbml@1.0.31+graphviz@15.1.1/edge-wasm-2',104 pikchr: 'pikchr@85e65b9686/edge-wasm-1',105 svgbob: 'svgbob@0.7.6/edge-wasm-1',106 goat: 'goat@0.5.1/edge-wasm-1',107 erd: 'erd@0.2.1.0+graphviz@15.1.1/edge-wasm-1',108 wireviz: 'wireviz@0.3.2/python-translator-1',109 structurizr: 'structurizr@6.2.2+plantuml@1.2026.6/translation-1',110 d2: 'd2@0.7.1/dagre-wasm-1',111 ditaa: 'ditaa-ascii+svgbob@0.7.6/edge-wasm-1',112 symbolator: 'symbolator@1.2.2/python-translation-1',113 tikz: '@planktimerr/tikzjax@1.0.63',114 trn: 'diagramzip-trn@16',115 umlet: 'diagramzip-umlet-svg@1',116}117118const losses: Partial<Record<EngineId, readonly string[]>> = {119 plantuml: [120 'Only SVG is supported.',121 'Remote, filesystem, arbitrary standard-library includes, and source-level theme directives are disabled.',122 'The browser-derived renderer uses bounded approximate DOM text metrics, so layout may differ from the native PlantUML Docker image.',123 ],124 c4plantuml: [125 'Only SVG is supported.',126 'The supported C4-PlantUML core is lowered to ordinary PlantUML primitives; advanced macros, icon sprites, and custom style macros are rejected explicitly.',127 'People, systems, containers, components, boundaries, core relationships, technology labels, tags, and the default C4 palette are retained semantically, but output is not pixel-compatible with native C4-PlantUML 2.7.0.',128 ],129 mermaid: ['External links and resource-loading elements are removed; XHTML labels retain only safe text formatting.'],130 bpmn: [131 'The bounded SVG renderer uses BPMN DI coordinates and a deliberately finite core symbol vocabulary; vendor-specific rendering extensions are ignored.',132 'Text uses deterministic browser-independent metrics and is not pixel-identical to bpmn-js.',133 'External resources, scripts, hyperlinks, and interactive overlays are not rendered.',134 ],135 graphviz: [136 'Only SVG is in the rendering contract.',137 'Resource-loading attributes such as image, imagepath, shapefile, fontpath, and stylesheet are rejected because the edge unit has no filesystem or network asset loader.',138 'The edge build uses GraphViz 15.1.1 versus the compatibility image GraphViz 14.1.3; output differences are possible.',139 'The GraphViz scale option is not supported by the edge-Wasm adapter.',140 ],141 pikchr: [142 'Only SVG is supported.',143 'Pikchr image/resource loading and renderer options are not exposed in the edge unit.',144 'The edge build is compiled from the pinned Kroki Pikchr source revision 85e65b968651b342c46e6334f4772b45d6cbb4317c5cbaa95d207779a50c6709.',145 ],146 svgbob: [147 'Only SVG is supported.',148 'Kroki stroke-color is not exposed in the edge unit; the pure upstream library does not load external images or resources.',149 'The edge build is compiled from upstream svgbob 0.7.6 at pinned commit 04a9d85c4b1879051f205e9e434e058864c3d36f.',150 ],151 goat: [152 'Only SVG is supported.',153 'Custom CSS files are not exposed; native light/dark color options and embedded default CSS are retained.',154 'Light and dark colors are limited to bounded named, hexadecimal, RGB(A), or HSL(A) values; CSS variables and resource-bearing values are rejected.',155 'The edge build uses TinyGo with a slice-based vendored iterator adaptation; geometry and source grammar remain upstream GoAT 0.5.1.',156 ],157 bytefield: ['Only SVG is in the v2 rendering contract.'],158 dbml: [159 'Only SVG is supported.',160 'DBML URLs are lowered to GraphViz HREFs, then external links are removed by SVG sanitization.',161 'The translated graph uses GraphViz 15.1.1 versus the compatibility DBML image Viz.js/GraphViz 2.47.0; output differences are possible.',162 ],163 diagramsnet: [164 'Rendering runs in the sandboxed official diagrams.net browser exporter; there is no server-side or Fly fallback.',165 'External resources are blocked; embedded data images remain supported.',166 ],167 excalidraw: [168 'Only SVG is supported.',169 'External resources are blocked; image data must be embedded in the scene.',170 'The Worker uses browser-independent canvas and font metrics, so text wrapping and typography may differ from browser Excalidraw.',171 ],172 nomnoml: ['Only SVG is in the v2 rendering contract.'],173 symbolator: [174 'Only SVG is supported.',175 'Native Cairo/Pango font shaping is replaced by deterministic browser-font estimates, so layout and typography differ from Symbolator 1.2.2.',176 'Filesystem library scanning and persisted array-type caches are unavailable; each request contains one bounded HDL source.',177 ],178 vega: ['URL-backed data and images are rejected; data must be embedded as values.', 'Only SVG is in the v2 rendering contract.'],179 vegalite: ['URL-backed data and images are rejected; data must be embedded as values.', 'Only SVG is in the v2 rendering contract.'],180 wavedrom: ['Only the six bundled Kroki skins are accepted.', 'Only SVG is in the v2 rendering contract.'],181 blockdiag: ['Remote and filesystem-backed images are rejected.', 'Only SVG output is supported.'],182 seqdiag: ['Remote and filesystem-backed images are rejected.', 'Only SVG output is supported.'],183 actdiag: ['Remote and filesystem-backed images are rejected.', 'Only SVG output is supported.'],184 nwdiag: ['Remote and filesystem-backed images are rejected.', 'Only SVG output is supported.'],185 packetdiag: ['Remote and filesystem-backed images are rejected.', 'Only SVG output is supported.'],186 rackdiag: ['Remote and filesystem-backed images are rejected.', 'Only SVG output is supported.'],187 erd: [188 'Only the source language and Kroki rendering mode are supported; ERD CLI and filesystem configuration modes are not exposed.',189 'The translated graph uses GraphViz 15.1.1 versus the compatibility image GraphViz 14.1.3; output differences are possible.',190 ],191 wireviz: [192 'Only SVG is supported; BOM and HTML sidecars are not exposed.',193 'Filesystem and remote images are rejected.',194 'tweak.append and tweak.override are rejected.',195 'The upstream source reports WireViz 0.3.2; the Dockerfile release label is 0.3.3.',196 'The translated graph uses GraphViz 15.1.1 versus the compatibility image GraphViz 14.1.3; output differences are possible.',197 ],198 structurizr: [199 'Only SVG is supported.',200 'Structurizr scripts, docs, plugins, filesystem access, and arbitrary remote themes are rejected.',201 'The bounded lowering preserves supported views, relationships, structural styles, and legends, but layout and typography may differ from native Structurizr export.',202 ],203 d2: [204 'Only SVG is supported.',205 'The edge build uses D2 v0.7.1 with its official bundled Dagre layout. ELK is unavailable.',206 'The supported animation-interval option is bounded to 1–60000 milliseconds; animated edges and multi-board SVG output remain supported.',207 ],208 ditaa: [209 'Only SVG is supported.',210 'Ditaa ASCII geometry, labels, and connectors are translated through the shared Svgbob 0.7.6 Worker dependency.',211 'Ditaa shape and color directives are removed; specialized shapes and per-shape colors are not retained.',212 'Shadows, rounded corners, anti-aliasing, and edge separation flags are accepted for compatibility but have no effect in the Svgbob pipeline.',213 ],214 tikz: [215 'The edge unit uses the pinned TikZJax TeX/PGF package set, not a full TeX Live installation.',216 'External files, package downloads, shell escape, hyperlinks, and external resources are unavailable.',217 'Typography and SVG details may differ from the browser TikZJax unit.',218 ],219 squaring: [220 'Networks are arranged by search, so very large or non-planar networks are rejected instead of drawn.',221 ],222 trn: [223 'The source selects one layout; the SVG does not embed an interactive layout toggle.',224 ],225 umlet: [226 'Only SVG is supported.',227 'The bounded translator preserves UXF coordinates but uses browser-independent SVG text metrics, so wrapping and typography differ from UMLet desktop.',228 'Known base and repository custom elements have direct SVG shapes; unknown custom Java elements render as visibly labeled generic boxes instead of executing custom code.',229 'Advanced PlotGrid and UMLSequenceAllInOne elements render as bounded labeled approximations.',230 'Interactive sticking, resizing, Java/GWT facets, themes, and custom class loading are intentionally unavailable.',231 ],232}233234export const ENGINE_CATALOG: readonly EngineCatalogEntry[] = ENGINE_IDS.map(id => ({235 id,236 targetRuntime: targetRuntime[id],237 activeRuntime: activeRuntime[id],238 version: versions[id],239 knownLosses: losses[id] ?? [],240 normalization: normalizationFor(id, versions[id]),241}))242243export const ENGINE_CATALOG_BY_ID = new Map(ENGINE_CATALOG.map(entry => [entry.id, entry]))