agentic-mermaid 0.4.1 → 0.5.3

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.
Files changed (253) hide show
  1. package/AGENT_NATIVE.md +94 -627
  2. package/CHANGELOG.md +651 -0
  3. package/Instructions_for_agents.md +44 -23
  4. package/LICENSES/Khroma-MIT.txt +21 -0
  5. package/LICENSES/Mermaid-MIT.txt +21 -0
  6. package/LICENSES/es-toolkit-MIT.txt +21 -0
  7. package/LICENSES/pele-MIT.txt +40 -0
  8. package/LICENSES/zenuml-core-MIT.txt +21 -0
  9. package/README.md +93 -50
  10. package/SECURITY.md +28 -12
  11. package/THIRD_PARTY_NOTICES.md +60 -0
  12. package/assets/hero.png +0 -0
  13. package/dist/agent-core.d.ts +478 -210
  14. package/dist/agent-core.js +1 -396
  15. package/dist/agent.d.ts +17 -8
  16. package/dist/agent.js +1 -408
  17. package/dist/agentic-mermaid-mcp.js +1 -11
  18. package/dist/am.js +1 -34562
  19. package/dist/browser-lazy/chunks/agentic-producer-core-CC6OOLDW.js +1 -0
  20. package/dist/browser-lazy/chunks/architecture-QUFVKYJR.js +13 -0
  21. package/dist/browser-lazy/chunks/block-6J3Q63BO.js +11 -0
  22. package/dist/browser-lazy/chunks/builtin-backends-7SOZZHPF.js +12 -0
  23. package/dist/browser-lazy/chunks/c4-SQVBZAKJ.js +10 -0
  24. package/dist/browser-lazy/chunks/chunk-2GPK4VFF.js +5 -0
  25. package/dist/browser-lazy/chunks/chunk-2I4UPL7Q.js +3 -0
  26. package/dist/browser-lazy/chunks/chunk-2SH76OTH.js +1 -0
  27. package/dist/browser-lazy/chunks/chunk-2UIA2IME.js +3 -0
  28. package/dist/browser-lazy/chunks/chunk-4LHYF3BS.js +1 -0
  29. package/dist/browser-lazy/chunks/chunk-5B2Z7575.js +1 -0
  30. package/dist/browser-lazy/chunks/chunk-5FQ534HP.js +1 -0
  31. package/dist/browser-lazy/chunks/chunk-5UVGUSD6.js +1 -0
  32. package/dist/browser-lazy/chunks/chunk-5X6MJX3H.js +1 -0
  33. package/dist/browser-lazy/chunks/chunk-AMJLVPUB.js +4 -0
  34. package/dist/browser-lazy/chunks/chunk-BU5LHXNJ.js +3 -0
  35. package/dist/browser-lazy/chunks/chunk-BY2CPG6B.js +1 -0
  36. package/dist/browser-lazy/chunks/chunk-CN7WTBWB.js +1 -0
  37. package/dist/browser-lazy/chunks/chunk-CQE4HQEW.js +1 -0
  38. package/dist/browser-lazy/chunks/chunk-CSFUKSU6.js +1 -0
  39. package/dist/browser-lazy/chunks/chunk-DF6765YX.js +17 -0
  40. package/dist/browser-lazy/chunks/chunk-E2WMJZNM.js +1 -0
  41. package/dist/browser-lazy/chunks/chunk-FAIMVOX5.js +6 -0
  42. package/dist/browser-lazy/chunks/chunk-GVOEAY52.js +1 -0
  43. package/dist/browser-lazy/chunks/chunk-HLWUNUCM.js +1 -0
  44. package/dist/browser-lazy/chunks/chunk-ICC7HBJX.js +1 -0
  45. package/dist/browser-lazy/chunks/chunk-J35HAQQF.js +20 -0
  46. package/dist/browser-lazy/chunks/chunk-J7FFAFQF.js +1 -0
  47. package/dist/browser-lazy/chunks/chunk-LH7HUDKW.js +1 -0
  48. package/dist/browser-lazy/chunks/chunk-N5ELX7LR.js +2 -0
  49. package/dist/browser-lazy/chunks/chunk-NMQQMRIR.js +1 -0
  50. package/dist/browser-lazy/chunks/chunk-NO7ZIVRU.js +1 -0
  51. package/dist/browser-lazy/chunks/chunk-OZ443IVJ.js +16 -0
  52. package/dist/browser-lazy/chunks/chunk-PQGPS2YV.js +7 -0
  53. package/dist/browser-lazy/chunks/chunk-QA6GJQ4X.js +1 -0
  54. package/dist/browser-lazy/chunks/chunk-RIVTHZAQ.js +1 -0
  55. package/dist/browser-lazy/chunks/chunk-SZELX2EJ.js +1 -0
  56. package/dist/browser-lazy/chunks/chunk-TYZOZXUJ.js +22 -0
  57. package/dist/browser-lazy/chunks/chunk-UL6NDWLL.js +1 -0
  58. package/dist/browser-lazy/chunks/chunk-VQYYGAXP.js +1 -0
  59. package/dist/browser-lazy/chunks/chunk-VWVZGQE2.js +1 -0
  60. package/dist/browser-lazy/chunks/chunk-X2UYKWKM.js +4 -0
  61. package/dist/browser-lazy/chunks/chunk-YCEICNM6.js +1 -0
  62. package/dist/browser-lazy/chunks/chunk-Z3FDIVLN.js +20 -0
  63. package/dist/browser-lazy/chunks/class-5QA4SCTS.js +13 -0
  64. package/dist/browser-lazy/chunks/decode-63UIZGD2.js +1 -0
  65. package/dist/browser-lazy/chunks/elk.bundled-L4CADV5W.js +24 -0
  66. package/dist/browser-lazy/chunks/er-7ZSKGN7Y.js +11 -0
  67. package/dist/browser-lazy/chunks/eventmodeling-2BPLHWRN.js +19 -0
  68. package/dist/browser-lazy/chunks/flowchart-NEIMZTB5.js +4 -0
  69. package/dist/browser-lazy/chunks/forest-implementation-AEP24AIP.js +1 -0
  70. package/dist/browser-lazy/chunks/gantt-RDPIFYAF.js +11 -0
  71. package/dist/browser-lazy/chunks/gitgraph-N4Y5RYB7.js +9 -0
  72. package/dist/browser-lazy/chunks/ishikawa-LD3YBDJN.js +6 -0
  73. package/dist/browser-lazy/chunks/journey-6YQR5DJX.js +16 -0
  74. package/dist/browser-lazy/chunks/kanban-PLMJ7NBW.js +20 -0
  75. package/dist/browser-lazy/chunks/mermaid-yaml-runtime-QVYX4EWK.js +136 -0
  76. package/dist/browser-lazy/chunks/mindmap-K2UBFO3Y.js +12 -0
  77. package/dist/browser-lazy/chunks/packet-CUW4QY6Y.js +7 -0
  78. package/dist/browser-lazy/chunks/pie-7F7UUCG3.js +15 -0
  79. package/dist/browser-lazy/chunks/quadrant-TOONO2WC.js +10 -0
  80. package/dist/browser-lazy/chunks/radar-J6JVWVAX.js +16 -0
  81. package/dist/browser-lazy/chunks/render-core-BZOM3K7D.js +3 -0
  82. package/dist/browser-lazy/chunks/requirement-CMAKDJPO.js +19 -0
  83. package/dist/browser-lazy/chunks/sankey-AWXQEP3F.js +13 -0
  84. package/dist/browser-lazy/chunks/sequence-Q2RJRB4L.js +5 -0
  85. package/dist/browser-lazy/chunks/state-WRBFQEDX.js +4 -0
  86. package/dist/browser-lazy/chunks/timeline-D2KILFXM.js +6 -0
  87. package/dist/browser-lazy/chunks/treemap-N3VYX5D4.js +6 -0
  88. package/dist/browser-lazy/chunks/xychart-G73OGK66.js +16 -0
  89. package/dist/browser-lazy/chunks/zenuml-H4BXNYXR.js +16 -0
  90. package/dist/browser-lazy/index.d.ts +544 -275
  91. package/dist/browser-lazy/index.js +1 -1
  92. package/dist/browser.global.js +802 -565
  93. package/dist/chunk-3LGLPG33.js +2 -0
  94. package/dist/chunk-7CRDX2QR.js +2 -0
  95. package/dist/chunk-7PPW2BMO.js +2 -0
  96. package/dist/chunk-DQDKA5ND.js +2 -0
  97. package/dist/chunk-EHCMJUMD.js +52 -0
  98. package/dist/chunk-GVCHLSHH.js +4 -0
  99. package/dist/chunk-H3NCS2XZ.js +19 -0
  100. package/dist/chunk-JZOJ4YGS.js +201 -0
  101. package/dist/chunk-MKE7GNYU.js +146 -0
  102. package/dist/chunk-NKNFOREZ.js +2 -0
  103. package/dist/chunk-O7H2UX5K.js +2 -0
  104. package/dist/chunk-OMY6NRQD.js +58 -0
  105. package/dist/chunk-UA234O4M.js +4 -0
  106. package/dist/chunk-VUFVLGTH.js +2 -0
  107. package/dist/chunk-XU5LPD2D.js +2 -0
  108. package/dist/cli-YGGTJZH7.js +226 -0
  109. package/dist/elk-constructor.js +2 -0
  110. package/dist/elk-constructor.node.js +11 -0
  111. package/dist/index-EeXqJXr5.d.ts +1223 -0
  112. package/dist/index.d.ts +4 -1
  113. package/dist/index.js +1 -334
  114. package/dist/jsonl-RPJY6YWO.js +2 -0
  115. package/dist/mcp-cli-63DYXTVD.js +2 -0
  116. package/dist/{index-BGA_-6LV.d.ts → paint-certification-6rwQjIv_.d.ts} +5283 -6173
  117. package/dist/server-5NEOHOFS.js +524 -0
  118. package/dist/svg-styles-BdnoM7AT.d.ts +724 -0
  119. package/dist/svg-styles.d.ts +1 -0
  120. package/dist/svg-styles.js +2 -0
  121. package/dist/svg.d.ts +13 -0
  122. package/dist/svg.js +2 -0
  123. package/dist/types-BcS52Mjt.d.ts +1360 -0
  124. package/dist/zenuml/chunks/appearance-UOQ5KA6O.js +1 -0
  125. package/dist/zenuml/chunks/builtin-backends-KDKE7YHO.js +12 -0
  126. package/dist/zenuml/chunks/chunk-42DXZ5C6.js +4 -0
  127. package/dist/zenuml/chunks/chunk-7TVYPTDW.js +1 -0
  128. package/dist/zenuml/chunks/chunk-EVPSMEKN.js +1 -0
  129. package/dist/zenuml/chunks/chunk-OXQWRSBM.js +20 -0
  130. package/dist/zenuml/chunks/chunk-QWX77U7G.js +2 -0
  131. package/dist/zenuml/chunks/chunk-RLJEI7YN.js +29 -0
  132. package/dist/zenuml/chunks/chunk-RZ6XK5CD.js +29 -0
  133. package/dist/zenuml/chunks/decode-BWERFDGK.js +1 -0
  134. package/dist/zenuml/chunks/mermaid-yaml-runtime-KZVU74WU.js +136 -0
  135. package/dist/zenuml/chunks/render-core-V5RQ737O.js +3 -0
  136. package/dist/zenuml/chunks/zenuml-EA2ZFRUX.js +20 -0
  137. package/dist/zenuml-frame.global.js +3626 -0
  138. package/dist/zenuml.d.ts +83 -0
  139. package/dist/zenuml.js +1 -0
  140. package/docs/MCP-DIRECTORY-LISTINGS.md +5 -1
  141. package/docs/README.md +59 -103
  142. package/docs/agent-api-cookbook.md +26 -16
  143. package/docs/agent-mutation-policy.md +86 -15
  144. package/docs/agent-workflow-examples.md +1 -1
  145. package/docs/api-advanced.md +385 -0
  146. package/docs/api.md +320 -366
  147. package/docs/ascii.md +40 -4
  148. package/docs/browser.md +46 -7
  149. package/docs/choosing-a-diagram.md +148 -0
  150. package/docs/code-mode-impact.md +1 -0
  151. package/docs/comparison.md +244 -28
  152. package/docs/computational-aesthetics-prototype-plan.md +10 -10
  153. package/docs/config.md +60 -2
  154. package/docs/custom-fonts.md +78 -21
  155. package/docs/diagram-families.md +160 -10
  156. package/docs/eventmodeling-and-zenuml.md +165 -0
  157. package/docs/features.md +21 -19
  158. package/docs/fork-differences.md +105 -32
  159. package/docs/getting-started.md +56 -51
  160. package/docs/layout-certification.md +126 -0
  161. package/docs/mcp-code-mode-rationale.md +20 -12
  162. package/docs/mcp-http-transport.md +14 -8
  163. package/docs/quality.md +145 -15
  164. package/docs/react.md +76 -31
  165. package/docs/style-authoring.md +23 -11
  166. package/docs/svg-semantic-contract.md +104 -4
  167. package/docs/testing-strategy.md +684 -126
  168. package/docs/theming.md +27 -8
  169. package/examples/styles/readme-hero.md +25 -0
  170. package/examples/styles/readme-hero.mmd +13 -0
  171. package/examples/styles/readme-hero.style.json +7 -0
  172. package/package.json +114 -57
  173. package/server.json +2 -2
  174. package/skills/agentic-mermaid-diagram-workflow/SKILL.md +26 -8
  175. package/skills/agentic-mermaid-diagram-workflow/references/cli.md +13 -3
  176. package/skills/agentic-mermaid-diagram-workflow/references/code-mode.md +2 -1
  177. package/skills/agentic-mermaid-diagram-workflow/references/flowchart.md +9 -6
  178. package/skills/agentic-mermaid-diagram-workflow/references/hosted-mcp.md +1 -0
  179. package/skills/agentic-mermaid-diagram-workflow/references/sequence.md +4 -3
  180. package/skills/agentic-mermaid-diagram-workflow/references/timeline.md +7 -6
  181. package/skills/agentic-mermaid-diagram-workflow/references/upstream/agentflow.md +574 -0
  182. package/skills/agentic-mermaid-diagram-workflow/references/upstream/architecture.md +10 -2
  183. package/skills/agentic-mermaid-diagram-workflow/references/upstream/c4.md +18 -0
  184. package/skills/agentic-mermaid-diagram-workflow/references/upstream/classDiagram.md +123 -0
  185. package/skills/agentic-mermaid-diagram-workflow/references/upstream/cynefin.md +6 -1
  186. package/skills/agentic-mermaid-diagram-workflow/references/upstream/entityRelationshipDiagram.md +129 -9
  187. package/skills/agentic-mermaid-diagram-workflow/references/upstream/eventmodeling.md +22 -0
  188. package/skills/agentic-mermaid-diagram-workflow/references/upstream/flowchart.md +188 -60
  189. package/skills/agentic-mermaid-diagram-workflow/references/upstream/gitgraph.md +13 -7
  190. package/skills/agentic-mermaid-diagram-workflow/references/upstream/mindmap.md +110 -1
  191. package/skills/agentic-mermaid-diagram-workflow/references/upstream/packet.md +38 -0
  192. package/skills/agentic-mermaid-diagram-workflow/references/upstream/requirementDiagram.md +115 -0
  193. package/skills/agentic-mermaid-diagram-workflow/references/upstream/sequenceDiagram.md +101 -0
  194. package/skills/agentic-mermaid-diagram-workflow/references/upstream/stateDiagram.md +87 -0
  195. package/skills/agentic-mermaid-diagram-workflow/references/upstream/swimlanes.md +105 -2
  196. package/skills/agentic-mermaid-diagram-workflow/references/upstream/timeline.md +12 -6
  197. package/skills/agentic-mermaid-diagram-workflow/references/upstream/usecase.md +953 -0
  198. package/skills/agentic-mermaid-diagram-workflow/references/upstream/venn.md +77 -0
  199. package/skills/agentic-mermaid-diagram-workflow/references/upstream/xyChart.md +1 -1
  200. package/dist/browser-lazy/chunks/architecture-KTHE2HX3.js +0 -31
  201. package/dist/browser-lazy/chunks/chunk-2XCPFAD5.js +0 -46
  202. package/dist/browser-lazy/chunks/chunk-3H4F7RBT.js +0 -1
  203. package/dist/browser-lazy/chunks/chunk-4EVLW2NJ.js +0 -1
  204. package/dist/browser-lazy/chunks/chunk-5Q4S74UO.js +0 -1
  205. package/dist/browser-lazy/chunks/chunk-6OAPWSDO.js +0 -1
  206. package/dist/browser-lazy/chunks/chunk-A7L4WWVW.js +0 -143
  207. package/dist/browser-lazy/chunks/chunk-C7FJO2I3.js +0 -4
  208. package/dist/browser-lazy/chunks/chunk-D3XXDKIO.js +0 -1
  209. package/dist/browser-lazy/chunks/chunk-DXA5WL7H.js +0 -4
  210. package/dist/browser-lazy/chunks/chunk-EPFMQPXX.js +0 -1
  211. package/dist/browser-lazy/chunks/chunk-FFOHLPDA.js +0 -2
  212. package/dist/browser-lazy/chunks/chunk-FLD63DXE.js +0 -2
  213. package/dist/browser-lazy/chunks/chunk-G6OLSHRG.js +0 -7
  214. package/dist/browser-lazy/chunks/chunk-GRXCKTHX.js +0 -0
  215. package/dist/browser-lazy/chunks/chunk-I6VE56S7.js +0 -1
  216. package/dist/browser-lazy/chunks/chunk-KJVNXJ5Y.js +0 -1
  217. package/dist/browser-lazy/chunks/chunk-L227EPFP.js +0 -11
  218. package/dist/browser-lazy/chunks/chunk-LNIHDJSF.js +0 -1
  219. package/dist/browser-lazy/chunks/chunk-M6BT2HIP.js +0 -1
  220. package/dist/browser-lazy/chunks/chunk-NZRUMODH.js +0 -1
  221. package/dist/browser-lazy/chunks/chunk-OFRMKQA6.js +0 -1
  222. package/dist/browser-lazy/chunks/chunk-P7HMSKHJ.js +0 -1
  223. package/dist/browser-lazy/chunks/chunk-PXKL3O6H.js +0 -1
  224. package/dist/browser-lazy/chunks/chunk-PZEWZT35.js +0 -1
  225. package/dist/browser-lazy/chunks/chunk-STQRDZ67.js +0 -1
  226. package/dist/browser-lazy/chunks/chunk-SUFMSWTX.js +0 -1
  227. package/dist/browser-lazy/chunks/chunk-T7IJ6V4B.js +0 -3
  228. package/dist/browser-lazy/chunks/chunk-UAEZO5VL.js +0 -1
  229. package/dist/browser-lazy/chunks/chunk-WEUWIFG3.js +0 -1
  230. package/dist/browser-lazy/chunks/chunk-X64T74C5.js +0 -24
  231. package/dist/browser-lazy/chunks/class-F7R6TJ73.js +0 -9
  232. package/dist/browser-lazy/chunks/er-BDK7CM5L.js +0 -9
  233. package/dist/browser-lazy/chunks/flowchart-KFU6XV7S.js +0 -4
  234. package/dist/browser-lazy/chunks/gantt-I64VVDSP.js +0 -28
  235. package/dist/browser-lazy/chunks/gitgraph-EDUVJ5IJ.js +0 -8
  236. package/dist/browser-lazy/chunks/journey-TLO2RNM3.js +0 -40
  237. package/dist/browser-lazy/chunks/mindmap-OJCNDYPM.js +0 -9
  238. package/dist/browser-lazy/chunks/pie-HVG6XO7K.js +0 -19
  239. package/dist/browser-lazy/chunks/quadrant-U6S2L4MJ.js +0 -24
  240. package/dist/browser-lazy/chunks/radar-ZDLOBTVG.js +0 -32
  241. package/dist/browser-lazy/chunks/render-core-Y2DFNMQG.js +0 -12
  242. package/dist/browser-lazy/chunks/sequence-Z4WFS3VB.js +0 -12
  243. package/dist/browser-lazy/chunks/state-2HV2YGN3.js +0 -4
  244. package/dist/browser-lazy/chunks/timeline-XM4UFPOC.js +0 -20
  245. package/dist/browser-lazy/chunks/xychart-7JDHWTQY.js +0 -36
  246. package/dist/chunk-GGXCNCNA.js +0 -4118
  247. package/dist/chunk-IVD4NXNE.js +0 -615
  248. package/dist/chunk-JDMRPUAG.js +0 -37
  249. package/dist/chunk-JWAAW3FH.js +0 -149
  250. package/dist/chunk-LCGBT32P.js +0 -62036
  251. package/dist/chunk-RWMZRUIC.js +0 -4715
  252. package/dist/mcp-cli-4MLKC3ZH.js +0 -17
  253. package/docs/mutation-testing.md +0 -285
@@ -0,0 +1,83 @@
1
+ import { R as RenderOptions } from './types-BcS52Mjt.js';
2
+ import { S as StyleInput } from './svg-styles-BdnoM7AT.js';
3
+
4
+ /** Optional browser-only backend. No ZenUML dependency enters the default graph. */
5
+ declare class ZenUMLBackendError extends Error {
6
+ readonly code: 'UNSUPPORTED_RUNTIME' | 'BACKEND_UNAVAILABLE' | 'INVALID_SOURCE' | 'RENDER_FAILED' | 'UNSUPPORTED_APPEARANCE';
7
+ constructor(code: 'UNSUPPORTED_RUNTIME' | 'BACKEND_UNAVAILABLE' | 'INVALID_SOURCE' | 'RENDER_FAILED' | 'UNSUPPORTED_APPEARANCE', message: string);
8
+ }
9
+ declare const UPSTREAM_ZENUML_CAPABILITIES: Readonly<{
10
+ maturity: "experimental";
11
+ sourcePreservation: true;
12
+ nativeParse: false;
13
+ typedEditing: false;
14
+ rendering: "optional-browser-iframe";
15
+ asynchronous: true;
16
+ terminal: false;
17
+ node: false;
18
+ cli: false;
19
+ mcp: false;
20
+ backend: "@zenuml/core@3.47.9";
21
+ nativeScene: false;
22
+ styles: false;
23
+ palettes: true;
24
+ rolePaints: true;
25
+ reusableSession: true;
26
+ }>;
27
+ interface UpstreamZenUMLRenderOptions {
28
+ timeoutMs?: number;
29
+ /** Named palettes or paint-only node/edge/group/label fragments. Native Look
30
+ * geometry, fonts and sketch effects are rejected, never silently ignored. */
31
+ style?: StyleInput | StyleInput[];
32
+ }
33
+ interface UpstreamZenUMLOptions extends UpstreamZenUMLRenderOptions {
34
+ /** URL of the shipped zenuml-frame.global.js, served by the consumer. */
35
+ backendURL: string | URL;
36
+ }
37
+ interface UpstreamZenUMLRenderer {
38
+ /** Requests are serialized; at most 32 calls may be pending per session. */
39
+ render(source: string, options?: UpstreamZenUMLRenderOptions): Promise<string>;
40
+ /** Release the isolated backend and reject active and queued requests. */
41
+ dispose(): void;
42
+ }
43
+ /** An explicitly owned session retains one isolated backend. Every render
44
+ * still parses and lays out its input; no source/SVG result cache is used. */
45
+ declare function createUpstreamZenUMLRenderer(options: UpstreamZenUMLOptions): UpstreamZenUMLRenderer;
46
+ /** One-shot rendering shares the session implementation and always releases
47
+ * its frame. Use createUpstreamZenUMLRenderer for repeated previews, then dispose it. */
48
+ declare function renderUpstreamZenUMLSVG(source: string, options: UpstreamZenUMLOptions): Promise<string>;
49
+
50
+ declare const ZENUML_CAPABILITIES: Readonly<{
51
+ maturity: "experimental";
52
+ sourcePreservation: true;
53
+ nativeParse: true;
54
+ typedEditing: true;
55
+ rendering: "native-scene";
56
+ asynchronous: true;
57
+ terminal: true;
58
+ node: true;
59
+ cli: true;
60
+ mcp: true;
61
+ backend: "native-sequence-scene";
62
+ nativeScene: true;
63
+ styles: true;
64
+ palettes: true;
65
+ rolePaints: true;
66
+ reusableSession: true;
67
+ }>;
68
+ interface ZenUMLRenderOptions extends RenderOptions {
69
+ /** Deadline for asynchronous dependency loading. Synchronous layout cannot
70
+ * be interrupted while the JavaScript event loop is executing it. */
71
+ timeoutMs?: number;
72
+ }
73
+ type ZenUMLOptions = ZenUMLRenderOptions;
74
+ interface ZenUMLRenderer {
75
+ render(source: string, options?: ZenUMLRenderOptions): Promise<string>;
76
+ dispose(): void;
77
+ }
78
+ /** Native Zen sessions serialize rendering and retain no source/SVG results.
79
+ * Named defaults resolve at each request's synchronous admission boundary. */
80
+ declare function createZenUMLRenderer(options?: ZenUMLOptions): ZenUMLRenderer;
81
+ declare function renderZenUMLSVG(source: string, options?: ZenUMLOptions): Promise<string>;
82
+
83
+ export { UPSTREAM_ZENUML_CAPABILITIES, type UpstreamZenUMLOptions, type UpstreamZenUMLRenderOptions, type UpstreamZenUMLRenderer, ZENUML_CAPABILITIES, ZenUMLBackendError, type ZenUMLOptions, type ZenUMLRenderOptions, type ZenUMLRenderer, createUpstreamZenUMLRenderer, createZenUMLRenderer, renderUpstreamZenUMLSVG, renderZenUMLSVG };
package/dist/zenuml.js ADDED
@@ -0,0 +1 @@
1
+ import{f as e}from"./zenuml/chunks/chunk-42DXZ5C6.js";import"./zenuml/chunks/chunk-OXQWRSBM.js";import{e as t,j as n,k as r}from"./zenuml/chunks/chunk-QWX77U7G.js";import"./zenuml/chunks/chunk-RLJEI7YN.js";import"./zenuml/chunks/chunk-RZ6XK5CD.js";import"./zenuml/chunks/chunk-EVPSMEKN.js";var o=class extends Error{constructor(e,t){super(t),this.code=e,this.name="ZenUMLBackendError"}code},i=Object.freeze({maturity:"experimental",sourcePreservation:!0,nativeParse:!1,typedEditing:!1,rendering:"optional-browser-iframe",asynchronous:!0,terminal:!1,node:!1,cli:!1,mcp:!1,backend:"@zenuml/core@3.47.9",nativeScene:!1,styles:!1,palettes:!0,rolePaints:!0,reusableSession:!0});function s(e){try{return n(()=>{let n=r(e);return t(n,"ZenUML style",{allowUndefinedObjectProperties:!0}),n})}catch(e){throw new o("UNSUPPORTED_APPEARANCE",e instanceof Error?e.message:String(e))}}function a(e){let t;if(typeof document>"u"||typeof MessageChannel>"u")throw new o("UNSUPPORTED_RUNTIME","ZenUML rendering requires a browser document; use the optional browser backend.");try{t=new URL(e.backendURL,document.baseURI)}catch{throw new o("BACKEND_UNAVAILABLE","The ZenUML backend URL is invalid.")}if(!["http:","https:"].includes(t.protocol)||t.origin!==new URL(document.baseURI).origin)throw new o("BACKEND_UNAVAILABLE","The ZenUML frame script must be served from the same HTTP(S) origin.");let n=void 0===e.style?void 0:s(e.style),r=e.timeoutMs??3e4,i=!1,a=0,d=0,c,l,u,m=new Set,p=[],h=!1,f=e=>new o("BACKEND_UNAVAILABLE",e),U=()=>{c?.remove(),c=void 0,l=void 0,d=0},y=(e,n,r)=>new Promise((i,s)=>{d>=64&&U(),d++;let a=new MessageChannel,m=!1,p=()=>{m=!0,clearTimeout(y),a.port1.close(),a.port2.close(),u===h&&(u=void 0)},h=e=>{m||(p(),"INVALID_SOURCE"!==e.code&&U(),s(e))};u=h;let y=setTimeout(()=>h(f("ZenUML backend did not complete before its deadline.")),r);a.port1.onmessage=e=>{if(m)return;let t=e.data;t?.ok===!0&&"string"==typeof t.svg?(p(),i(t.svg)):h(new o(t?.code==="INVALID_SOURCE"?"INVALID_SOURCE":"RENDER_FAILED",String(t?.message??"ZenUML rendering failed.")))},Promise.resolve().then(()=>m?void 0:(()=>{if(l)return l;(c=document.createElement("iframe")).style.cssText="position:fixed;left:-100000px;top:0;width:1024px;height:768px;visibility:hidden;pointer-events:none;border:0",c.setAttribute("aria-hidden","true"),c.setAttribute("sandbox","allow-scripts allow-same-origin"),l=new Promise(e=>{c.onload=()=>e()});let e=t.href.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");return c.srcdoc=`<!doctype html><html><head><script src="${e}"></script></head><body></body></html>`,(document.body??document.documentElement).append(c),l})()).then(()=>{m||u!==h||c?.contentWindow?.postMessage({type:"agentic-zenuml",source:e,appearance:n},t.origin,[a.port2])}).catch(()=>h(f("The ZenUML frame could not be loaded.")))});return{async render(e,t={}){if(i)throw f("The ZenUML renderer has been disposed.");if("string"!=typeof e||!/^\s*zenuml\b/.test(e)||!e.replace(/^\s*zenuml\b/,"").trim())throw new o("INVALID_SOURCE","Expected a nonempty ZenUML document.");if(a>=32)throw f("The ZenUML renderer already has 32 pending requests.");a++;let d,c,l,u,U,w=new Promise((e,t)=>{u=e,U=t}),L,b=new Promise((e,t)=>{L=t});b.catch(()=>{});let M=!1,E=()=>{M=!0,a--,m.delete(A);let e=p.indexOf(v);e>=0&&p.splice(e,1)},g=e=>{M||(E(),U(e))},A=e=>{L(e),g(e)},v=async()=>{if(!M)try{let t;if(i)throw f("The ZenUML renderer has been disposed.");if(void 0===c)t=await y(e,void 0,d);else{let n=performance.now(),r,o=new Promise((e,t)=>{r=setTimeout(()=>t(f("ZenUML palette admission did not complete before its deadline.")),d)}),s;try{s=await Promise.race([l,b,o])}finally{clearTimeout(r)}if(i)throw f("The ZenUML renderer has been disposed.");t=await y(e,s,Math.max(0,d-(performance.now()-n)))}M||(E(),u(t))}catch(e){g(e)}};m.add(A),p.push(v);try{if(d=t.timeoutMs??r,!Number.isFinite(d)||d<=0)throw f("timeoutMs must be positive and finite.");let e="style"in t?t.style:n;c=void 0===e?void 0:s(e),M||(l=void 0===c?Promise.resolve(void 0):import("./zenuml/chunks/appearance-UOQ5KA6O.js").then(e=>{try{return e.resolveZenUMLAppearance(c)}catch(e){throw new o("UNSUPPORTED_APPEARANCE",e instanceof Error?e.message:String(e))}},()=>{throw f("The ZenUML palette module could not be loaded.")})).catch(()=>{})}catch(e){g(e)}return h||(h=!0,queueMicrotask(async()=>{try{for(;p.length;)await p.shift()()}finally{h=!1}})),w},dispose(){i=!0;let e=f("The ZenUML renderer has been disposed.");for(let t of(u?.(e),m))t(e);U()}}}async function d(e,t){let n=a(t);try{return await n.render(e)}finally{n.dispose()}}var c=Object.freeze({maturity:"experimental",sourcePreservation:!0,nativeParse:!0,typedEditing:!0,rendering:"native-scene",asynchronous:!0,terminal:!0,node:!0,cli:!0,mcp:!0,backend:"native-sequence-scene",nativeScene:!0,styles:!0,palettes:!0,rolePaints:!0,reusableSession:!0});function l(t,n={},r=3e4){if(!t||"object"!=typeof t&&"function"!=typeof t)throw TypeError("ZenUML render options must be an object.");if("backendURL"in t)throw TypeError("backendURL belongs to createUpstreamZenUMLRenderer/renderUpstreamZenUMLSVG; native ZenUML needs no backend URL.");let{timeoutMs:o=r,...i}=t;if(!Number.isFinite(o)||o<=0)throw TypeError("timeoutMs must be positive and finite.");return{timeout:o,options:e({...n,...i})}}function u(e={}){let t=l(e),n=[],r=new Set,i=!1,s=0,a=!1,d=e=>new o("BACKEND_UNAVAILABLE",e);return{async render(e,c={}){if(i)throw d("The ZenUML renderer has been disposed.");if("string"!=typeof e||!e.trim())throw new o("INVALID_SOURCE","Expected a nonempty ZenUML document.");if(s>=32)throw d("The ZenUML renderer already has 32 pending requests.");s++;let u,m,p,h=new Promise((e,t)=>{m=e,p=t}),f,U=new Promise((e,t)=>{f=t});U.catch(()=>{});let y=!1,w,L=()=>{y=!0,clearTimeout(w),s--,r.delete(b);let e=n.indexOf(M);e>=0&&n.splice(e,1)},b=e=>{y||(f(e),L(),p(e))},M=async()=>{if(!y){w=setTimeout(()=>b(d("ZenUML rendering did not complete before its deadline.")),u.timeout);try{let t=async()=>{let[{default:t},{renderLoadedFamilySvg:n}]=await Promise.all([import("./zenuml/chunks/zenuml-EA2ZFRUX.js"),import("./zenuml/chunks/render-core-V5RQ737O.js")]);if(y)throw d("The ZenUML request is no longer active.");return n(e,u.options,t)},n=await Promise.race([t(),U]);y||(L(),m(n))}catch(e){b(e)}}};r.add(b),n.push(M);try{u=l(c,t.options,t.timeout)}catch(e){b(e)}return a||(a=!0,queueMicrotask(async()=>{try{for(;n.length;)await n.shift()()}finally{a=!1}})),h},dispose(){i=!0;let e=d("The ZenUML renderer has been disposed.");for(let t of r)t(e)}}}async function m(e,t={}){let n=u(t);try{return await n.render(e)}finally{n.dispose()}}export{i as UPSTREAM_ZENUML_CAPABILITIES,c as ZENUML_CAPABILITIES,o as ZenUMLBackendError,a as createUpstreamZenUMLRenderer,u as createZenUMLRenderer,d as renderUpstreamZenUMLSVG,m as renderZenUMLSVG};
@@ -49,9 +49,13 @@ from `verify.ok` alone.
49
49
 
50
50
  ## Directory record
51
51
 
52
+ The root `server.json` prepares version `0.5.2`; this metadata change does not
53
+ establish Registry publication. The directory observations below retain their
54
+ recorded dates.
55
+
52
56
  | Directory | Registration input | Recorded status on 2026-07-30 |
53
57
  |---|---|---|
54
- | Official MCP Registry | Root [`server.json`](../server.json) | Active at version `0.4.0` |
58
+ | Official MCP Registry | Root [`server.json`](../server.json) | Active at version `0.4.1` (published to npm and the Registry on 2026-07-31) |
55
59
  | OpenAI Plugins | Endpoint plus canonical fields above | Account-gated submission; tool titles and privacy notice captured in this repository |
56
60
  | Claude Connectors Directory | Endpoint plus canonical fields above | Account-gated Team/Enterprise submission; tool titles and privacy notice captured in this repository |
57
61
  | Cursor Directory | Repository and endpoint | Not found in directory; account-gated submission remains |
package/docs/README.md CHANGED
@@ -1,105 +1,61 @@
1
1
  # Agentic Mermaid documentation
2
2
 
3
- This directory holds the long-form documentation. The root README is intentionally short and routes readers here. Consumer guides are included in the npm package; repository-only links use canonical GitHub URLs so this hub also works from an installed tarball.
4
-
5
- ## User docs
6
-
7
- | Doc | Purpose |
8
- |---|---|
9
- | [`getting-started.md`](./getting-started.md) | Plain library use: render a Mermaid string to SVG/PNG/ASCII in 5 minutes. |
10
- | [`api.md`](./api.md) | Library, agent API, output functions, options, CLI/MCP pointers. |
11
- | [`diagram-families.md`](./diagram-families.md) | Supported Mermaid families, examples, and edit policy. |
12
- | [`theming.md`](./theming.md) | Two-color themes, built-in themes, custom themes, Shiki import. |
13
- | [`style-authoring.md`](./style-authoring.md) | Style model, stack semantics, field reference, rubric, and validation commands. |
14
- | [`custom-style-cookbook.md`](./custom-style-cookbook.md) | Complete custom style JSON files, screenshots, schema usage, CLI commands, and the documentation-only Cupertino-, Vercel-, and Cloudflare Workers-inspired prototypes. |
15
- | [`design/families/style-switch-contact-sheet.html`](https://github.com/adewale/agentic-mermaid/blob/main/docs/design/families/style-switch-contact-sheet.html) | Self-contained interactive contact sheet for every registered family and every built-in Look/Palette Style resource. |
16
- | [`custom-fonts.md`](./custom-fonts.md) | How custom Styles select and resolve fonts across SVG, PNG, browser, and MCP surfaces. |
17
- | [`react.md`](./react.md) | Zero-flash React rendering with CSS variables. |
18
- | [`browser.md`](./browser.md) | Framework-neutral pre-rendering, Alpine and plain-JS adapters, the classic `<script src>` bundle, and the shipped lazy all-family browser renderer. |
19
- | [`ascii.md`](./ascii.md) | Terminal output, ASCII vs Unicode, color modes, XY charts. |
20
- | [`config.md`](./config.md) | `mermaidConfig`, YAML frontmatter, and init directives. |
21
- | [`features.md`](./features.md) | Capability inventory. |
22
- | [`quality.md`](./quality.md) | Determinism, quality metrics, and visual-review guidance. |
23
- | [`testing-strategy.md`](./testing-strategy.md) | What we test, how, and why: oracle types, the proof-gate map, and honest gaps. |
24
- | [`fork-differences.md`](./fork-differences.md) | How Agentic Mermaid differs from upstream Beautiful Mermaid. |
25
- | [`comparison.md`](./comparison.md) | Functionality differences between Mermaid, Beautiful Mermaid, and Agentic Mermaid — and when to use each. |
26
-
27
- ## Agent docs
28
-
29
- | Doc | Purpose |
30
- |---|---|
31
- | [`../Instructions_for_agents.md`](../Instructions_for_agents.md) | Canonical short guide; byte-identical to `am --agent-instructions`. |
32
- | [`../AGENT_NATIVE.md`](../AGENT_NATIVE.md) | Architecture/spec rationale for the agent-native surface. |
33
- | [`agent-api-cookbook.md`](./agent-api-cookbook.md) | Copy-pasteable library/CLI/MCP recipes. |
34
- | [`agent-mutation-policy.md`](./agent-mutation-policy.md) | Structured-vs-source-level edit policy. |
35
- | [`mcp-code-mode-rationale.md`](./mcp-code-mode-rationale.md) | Why MCP is Code Mode first. |
36
- | [`code-mode-impact.md`](./code-mode-impact.md) | Measured client/server impact, comparison with Cloudflare and Anthropic, and operational costs. |
37
- | [`mcp-http-transport.md`](./mcp-http-transport.md) | Local HTTP/SSE MCP quickstart plus hosted `/mcp` call-shape notes. |
38
- | [`agent-workflow-examples.md`](./agent-workflow-examples.md) | Runnable MCP/CLI and improvement-loop examples. |
39
- | [`../skills/`](../skills/) | Agent-agnostic skill bundles. |
40
- | [`../skill-evals/`](https://github.com/adewale/agentic-mermaid/tree/main/skill-evals) | Skill eval manifest, fixtures, and benchmark instructions. |
41
-
42
- ## Contributor / project docs
43
-
44
- The design docs split into two tiers — **system** (how the engine works, cross-cutting) and
45
- **per-family** (how one diagram type works).
46
-
47
- ### System design — how the engine works
48
-
49
- | Doc | Purpose |
50
- |---|---|
51
- | [`project/brand-primitives-plan.md`](https://github.com/adewale/agentic-mermaid/blob/main/docs/project/brand-primitives-plan.md) | Normative appearance/family-contract decision and A/B dependency/acceptance plan; live status is owned by root `TODO.md`. |
52
- | [`design/system/`](https://github.com/adewale/agentic-mermaid/blob/main/docs/design/system/README.md) | **Start here.** Current resolved-request, family-descriptor, positioned-artifact, and output-security architecture overview (dogfooded, drift-proof). |
53
- | [`design/system/route-contracts.md`](https://github.com/adewale/agentic-mermaid/blob/main/docs/design/system/route-contracts.md) | Route contracts: edge classification, direct-lane proofs, certifying straightener (issue #25). |
54
- | [`design/system/layout-rubric.md`](https://github.com/adewale/agentic-mermaid/blob/main/docs/design/system/layout-rubric.md) | Deterministic layout-quality rubric: metrics, CI gates, and property oracles. |
55
- | [`design/system/source-preservation-ladder.md`](https://github.com/adewale/agentic-mermaid/blob/main/docs/design/system/source-preservation-ladder.md) | The structured\|opaque family-adoption contract (levels L0–L4). |
56
- | [`design/mermaid-family-fidelity-audit.md`](https://github.com/adewale/agentic-mermaid/blob/main/docs/design/mermaid-family-fidelity-audit.md) | Mermaid 11.16 syntax accounting and Mermaid/Wikipedia visual-metaphor audit for every registered family. |
57
- | [`design/style-palette-compatibility.md`](https://github.com/adewale/agentic-mermaid/blob/main/docs/design/style-palette-compatibility.md) | Registry-derived exhaustive algebra plus complexity-aware variable-strength Style/Palette/family compatibility receipt. |
58
- | [`design/system/ugly-layouts.md`](https://github.com/adewale/agentic-mermaid/blob/main/docs/design/system/ugly-layouts.md) | Ugly-layout detector: catalogued failure shapes and heuristics. |
59
-
60
- ### Per-family design notes
61
-
62
- | Doc | Purpose |
63
- |---|---|
64
- | [`design/families/`](https://github.com/adewale/agentic-mermaid/blob/main/docs/design/families/README.md) | Per-family hub: which families have a design note, and where each family's other surfaces live. |
65
- | [`design/families/architecture-beta.md`](https://github.com/adewale/agentic-mermaid/blob/main/docs/design/families/architecture-beta.md) | `architecture-beta` diagram-type implementation notes. |
66
- | [`design/families/gantt.md`](https://github.com/adewale/agentic-mermaid/blob/main/docs/design/families/gantt.md) | Gantt support specification and compatibility boundaries. |
67
- | [`design/families/gantt-research.md`](https://github.com/adewale/agentic-mermaid/blob/main/docs/design/families/gantt-research.md) | Gantt literature review and commercial UX survey. |
68
- | [`design/families/journey.md`](https://github.com/adewale/agentic-mermaid/blob/main/docs/design/families/journey.md) | Journey diagram implementation notes. |
69
- | [`design/families/xychart.md`](https://github.com/adewale/agentic-mermaid/blob/main/docs/design/families/xychart.md) | XY chart implementation notes. |
70
- | [`design/families/flowchart-parser-conformance.md`](https://github.com/adewale/agentic-mermaid/blob/main/docs/design/families/flowchart-parser-conformance.md) | Flowchart syntax conformance catalogue and unsupported-syntax warning policy (issue #36). |
71
-
72
- > All per-family notes live in `design/families/` and all cross-cutting notes in `design/system/`.
73
-
74
- ### Project & process
75
-
76
- | Doc | Purpose |
77
- |---|---|
78
- | [`contributing/adding-diagram-types.md`](https://github.com/adewale/agentic-mermaid/blob/main/docs/contributing/adding-diagram-types.md) | How to add a Mermaid-supported diagram family. |
79
- | [`contributing/visual-review-evidence.md`](https://github.com/adewale/agentic-mermaid/blob/main/docs/contributing/visual-review-evidence.md) | Which reproducible visual artifacts are required for layout/rendering changes. |
80
- | [`contributing/diagram-family-citizenship.md`](https://github.com/adewale/agentic-mermaid/blob/main/docs/contributing/diagram-family-citizenship.md) | Enforced good-citizen checklist and matrix for family/surface drift (issue #41). |
81
- | [`contributing/harvesting-upstream-tests.md`](https://github.com/adewale/agentic-mermaid/blob/main/docs/contributing/harvesting-upstream-tests.md) | How to vendor upstream/fork test suites into an executable compatibility bench. |
82
- | [`contributing/releasing.md`](https://github.com/adewale/agentic-mermaid/blob/main/docs/contributing/releasing.md) | How to cut an npm release (GitHub Release → provenance publish) and flip the "published" copy. |
83
- | [`layout-characterization/README.md`](https://github.com/adewale/agentic-mermaid/blob/main/docs/layout-characterization/README.md) | Layout and visual testing approach: properties, contact sheets, raster contracts, and approval artifacts. |
84
- | [`svg-semantic-contract.md`](./svg-semantic-contract.md) | Typed Scene identity, geometry, references, and accessibility contract. |
85
- | [`mutation-testing.md`](./mutation-testing.md) | Mutation lanes, survivor handling, and fault-sensitivity evidence. |
86
- | [`project/divergences.md`](https://github.com/adewale/agentic-mermaid/blob/main/docs/project/divergences.md) | Deliberate divergences and guardrails. |
87
- | [`project/lessons-learned.md`](https://github.com/adewale/agentic-mermaid/blob/main/docs/project/lessons-learned.md) | Evergreen engineering lessons distilled from the archived fork narrative. |
88
- | [`project/agent-interface-contract-audit-2026-07.md`](https://github.com/adewale/agentic-mermaid/blob/main/docs/project/agent-interface-contract-audit-2026-07.md) | PR #162 defect provenance, review of PRs #157/#160, testing root causes, and recurrence controls. |
89
- | [`project/complexity-aware-test-portfolio-plan.md`](https://github.com/adewale/agentic-mermaid/blob/main/docs/project/complexity-aware-test-portfolio-plan.md) | Implemented measured migration from overlapping family/style matrices to automatic complexity-aware conformance, variable-strength interaction coverage, and periodic contact-sheet review. |
90
- | [`contributing/lessons-learned.md`](https://github.com/adewale/agentic-mermaid/blob/main/docs/contributing/lessons-learned.md) | Dated contributor process lessons (newest first). |
91
- | [`project/dogfooding-docs-strategy.md`](https://github.com/adewale/agentic-mermaid/blob/main/docs/project/dogfooding-docs-strategy.md) | How we render and pin our own docs with our own tools. |
92
- | [`project/archive/`](https://github.com/adewale/agentic-mermaid/tree/main/docs/project/archive) | Status-marked landing/completion evidence and frozen historical records; never live backlog authority. |
93
- | [`issue-derived-test-cases.md`](./issue-derived-test-cases.md) | Issue-derived regression coverage map. |
94
- | [`mermaid-layout-complaints.md`](./mermaid-layout-complaints.md) | Mermaid layout complaint catalog, root causes, and coverage scorecard. |
95
-
96
- ## Root docs kept intentionally
97
-
98
- - [`../README.md`](../README.md) — landing page and quick starts.
99
- - [`../CHANGELOG.md`](../CHANGELOG.md) — release notes.
100
- - [`../SECURITY.md`](../SECURITY.md) — conventional security entrypoint.
101
- - [`../TODO.md`](https://github.com/adewale/agentic-mermaid/blob/main/TODO.md) — only active backlog with unchecked boxes.
102
- - [`../Instructions_for_agents.md`](../Instructions_for_agents.md) — canonical agent guide emitted by CLI.
103
- - [`../AGENT_NATIVE.md`](../AGENT_NATIVE.md) — agent-native architecture/spec entrypoint.
104
- - [`../PRODUCT.md`](https://github.com/adewale/agentic-mermaid/blob/main/PRODUCT.md) — canonical product brief (brand register).
105
- - [`../DESIGN.md`](https://github.com/adewale/agentic-mermaid/blob/main/DESIGN.md) — canonical website design system.
3
+ Start with [Getting started](getting-started.md) to render a diagram. For an
4
+ agent editing an existing diagram, use the
5
+ [operating guide](../Instructions_for_agents.md), then the
6
+ [editing cookbook](agent-api-cookbook.md).
7
+
8
+ ## Choose a task
9
+
10
+ | Task | Guide |
11
+ | --- | --- |
12
+ | Render SVG, PNG or terminal text | [Getting started](getting-started.md) |
13
+ | Choose a diagram type | [Family examples](diagram-families.md) · [Choosing a diagram](choosing-a-diagram.md) |
14
+ | Edit a diagram through the API | [Editing cookbook](agent-api-cookbook.md) |
15
+ | Connect an MCP client | [MCP setup and transports](mcp-http-transport.md) |
16
+ | Render in a browser or React app | [Browser](browser.md) · [React](react.md) |
17
+ | Set colors, typography or drawing style | [Theming](theming.md) · [Style authoring](style-authoring.md) · [Visual cookbook](custom-style-cookbook.md) |
18
+ | Supply fonts | [Custom fonts](custom-fonts.md) |
19
+ | Use ASCII or Unicode | [Terminal output](ascii.md) |
20
+ | Configure Mermaid frontmatter or directives | [Configuration](config.md) |
21
+ | Understand a warning or failed render | [Quality](quality.md) · [Warning reference](https://agentic-mermaid.dev/warnings/) · [Error reference](https://agentic-mermaid.dev/errors/) |
22
+
23
+ ## API and behavior
24
+
25
+ - [API reference](api.md): functions, options, results and shared vocabulary.
26
+ - [Editing limits](agent-mutation-policy.md): typed and source-preserving edits.
27
+ - [Agent architecture](../AGENT_NATIVE.md): preservation, determinism and verification.
28
+ - [Security](../SECURITY.md): strict output, offline rendering and server boundaries.
29
+ - [Features](features.md) and [fork differences](fork-differences.md).
30
+ - [Comparison](comparison.md): dated measurements and differences from other tools.
31
+ - [Skills](../skills/): instructions for diagram authoring and editor work.
32
+
33
+ Run `am capabilities --json` for the families and operations in your installed
34
+ version. Use `am styles` to discover its styles. These commands are the current
35
+ inventories; dated reports describe only the revisions they measured.
36
+
37
+ ## Contribute
38
+
39
+ Repository-only documentation uses GitHub links so this index also works from
40
+ an installed npm package.
41
+
42
+ | Work | Start here |
43
+ | --- | --- |
44
+ | Understand the renderer | [System architecture](https://github.com/adewale/agentic-mermaid/blob/main/docs/design/system/README.md) |
45
+ | Work on one diagram family | [Family implementation notes](https://github.com/adewale/agentic-mermaid/blob/main/docs/design/families/README.md) |
46
+ | Add a family | [Adding diagram types](https://github.com/adewale/agentic-mermaid/blob/main/docs/contributing/adding-diagram-types.md) |
47
+ | Change layout or rendering | [Route contracts](https://github.com/adewale/agentic-mermaid/blob/main/docs/design/system/route-contracts.md) · [Visual review](https://github.com/adewale/agentic-mermaid/blob/main/docs/contributing/visual-review-evidence.md) |
48
+ | Select validation | [Testing strategy](testing-strategy.md) |
49
+ | Update documentation | [Doc consistency](https://github.com/adewale/agentic-mermaid/blob/main/docs/contributing/doc-consistency.md) |
50
+ | Prepare a release | [Release procedure](https://github.com/adewale/agentic-mermaid/blob/main/docs/contributing/releasing.md) |
51
+
52
+ ## Project records
53
+
54
+ [TODO.md](https://github.com/adewale/agentic-mermaid/blob/main/TODO.md) is the
55
+ active backlog. The [project index](https://github.com/adewale/agentic-mermaid/blob/main/docs/project/README.md)
56
+ separates current plans from completed and superseded work. Historical research
57
+ and benchmark receipts are context for those decisions, not additional release gates.
58
+
59
+ See the [changelog](../CHANGELOG.md) for release notes and
60
+ [Trident results](https://github.com/adewale/trident/blob/main/RESULTS.md) for
61
+ performance measurements and their scope.
@@ -12,7 +12,7 @@ Agentic Mermaid is not just a renderer. It is a structured edit loop:
12
12
  4. **Verify** before any commit point.
13
13
  5. **Serialize** only after inspecting `verify.ok`, `verify.warnings`, and, when relevant, `verify.layout`.
14
14
 
15
- For brand-new diagrams, author Mermaid source directly, then parse/verify/render. For existing modeled diagrams, prefer typed mutation so edits preserve structure and round-trip predictably.
15
+ <!-- BEGIN GENERATED: new-diagram-policy -->New diagrams: author Mermaid source directly, then parse → verify → render or return it. `buildMermaid(kind, ops)` / `createMermaid(kind)` build a diagram from typed ops when you are generating one programmatically (for example, from data).<!-- END GENERATED: new-diagram-policy --> For existing modeled diagrams, prefer typed mutation so edits preserve structure and round-trip predictably.
16
16
 
17
17
  ## Pick the right channel
18
18
 
@@ -23,7 +23,11 @@ For brand-new diagrams, author Mermaid source directly, then parse/verify/render
23
23
  | Hosted MCP | No local install is available, or a client wants bounded HTTP tools | `https://agentic-mermaid.dev/mcp` tools: `execute`, render/verify/describe, `mutate`, `build` |
24
24
  | CLI | Shell-only verification, rendering, preview, or one-shot mutation | `am ...` |
25
25
 
26
- All channels expose the same core contract: parse, optionally narrow, mutate, verify, serialize/render. Agentic Mermaid outputs SVG, PNG, ASCII, Unicode, and JSON layout.
26
+ All channels expose the same core contract: parse, select the typed family when
27
+ editing, mutate, verify, serialize/render. Selecting the family is called
28
+ **narrowing**, not selecting one source object or fixing its coordinates. See
29
+ the [shared vocabulary](./api.md#vocabulary). Agentic Mermaid outputs SVG, PNG,
30
+ ASCII, Unicode, and JSON layout.
27
31
 
28
32
  ## Recipe: author a new diagram
29
33
 
@@ -239,6 +243,7 @@ am render diagram.mmd --format ascii > diagram.txt
239
243
 
240
244
  MCP channel:
241
245
 
246
+ <!-- complete: hosted-mcp-tools -->
242
247
  - Local MCP: use Code Mode for parse/narrow/mutate/verify/serialize.
243
248
  - Local MCP: use the `render_png` helper for base64 PNG bytes when the host needs a raster artifact.
244
249
  - Local HTTP/SSE mode: use `render_png` with `output: "file"` or `output: "url"` when the host wants a managed artifact instead of inline base64.
@@ -281,20 +286,25 @@ Unsupported typed mutation is a stop signal, not a prompt to fake structure. Eit
281
286
 
282
287
  Tier 1 warnings are reliable structural/source checks. Do not suppress Tier 1 errors unless you fully understand the consequence.
283
288
 
284
- | Code | Meaning |
285
- |---|---|
286
- | `EMPTY_DIAGRAM` | Nothing renderable |
287
- | `EDGE_MISANCHORED` | Edge endpoint is not attached to a real target |
288
- | `OFF_CANVAS` | Node or edge segment lies outside canvas bounds |
289
- | `GROUP_BREACH` | Member lies outside its group bounds |
290
- | `UNKNOWN_SHAPE` | Shape fell back because the name is unrecognized |
291
- | `LABEL_OVERFLOW` | Label exceeds `labelCharCap` |
292
- | `UNRESOLVABLE_SCHEDULE` | Gantt parses but its schedule cannot resolve; render would fail |
293
- | `RENDER_FAILED` | Any family: verifies structurally but the strict render parser rejects the canonical source; `reason` carries the renderer error |
294
-
295
- Tier 2 warnings are advisory geometric checks — route tripwires for flowchart/state, plus boundary-anchor/overlap checks on class/ER entity boxes: `NODE_OVERLAP`, `ROUTE_SELF_CROSS`, and the route-contract tripwires `ROUTE_HITCH`, `ROUTE_UNEXPLAINED_BEND`, `ROUTE_LABEL_ON_SHARED_TRUNK`, `ROUTE_SELF_LOOP_OCCUPANCY`, `ROUTE_CONTAINER_MISANCHOR`, `ROUTE_SHAPE_MISANCHOR`, `ROUTE_STALE_AFTER_NODE_MOVE`.
296
-
297
- Tier 3 covers advisory lint plus caller-selected inspect-only Brand policy: `DUPLICATE_EDGE`, `UNREACHABLE_NODE`, `DECISION_BRANCH_UNLABELED`, `COMMENT_DROPPED`, `UNSUPPORTED_SYNTAX`, `CONTENT_DROPPED_ON_ROUNDTRIP`, `INEFFECTIVE_CONFIG`, `LOW_CONTRAST`, `BRAND_CONSTRAINT_WARNING`, `BRAND_CONSTRAINT_ERROR`. `LOW_CONTRAST` preserves authored paint and reports its foreground, final opaque background, ratio, and minimum; transparent output is not measured because its host backdrop is unknown. Brand constraints inspect final contrast, accent-area, or mono-role evidence without repainting or relayout. Advisory findings do not flip `verify.ok`; `BRAND_CONSTRAINT_ERROR` does only because the caller explicitly selected `action: "error"`.
289
+ <!-- BEGIN GENERATED: warning-table:structural -->
290
+ | Code | Severity | Description |
291
+ |---|---|---|
292
+ | `EMPTY_DIAGRAM` | error | Diagram contains no renderable elements |
293
+ | `EDGE_MISANCHORED` | error | Edge endpoint does not attach to a real node / participant |
294
+ | `OFF_CANVAS` | error | Node or edge segment lies outside the canvas |
295
+ | `GROUP_BREACH` | error | Member node lies outside its group's bounds |
296
+ | `UNKNOWN_SHAPE` | warning | Shape name unrecognized; default used |
297
+ | `LABEL_OVERFLOW` | warning | A label's longest rendered line exceeds the character cap (default 40, `labelCharCap`): `<br>` and `\n` split lines, XML entities count as one character, and formatting tags are stripped. Families that draw text literally (Pie, Timeline, Gantt, XYChart, GitGraph, Radar) count `<br>` and tags as characters, as drawn. Payload includes `charCount` and `limit`. Character-based, no font-table dependency. |
298
+ | `UNRESOLVABLE_SCHEDULE` | error | The diagram parses and round-trips but its semantics cannot resolve, so rendering will fail loudly. Emitted for structured gantt bodies whose scheduler raises a named `GANTT_*` error (unknown task reference, bad calendar date, dependency cycle, everything-excluded calendar); the payload's `reason` carries that error. |
299
+ | `RENDER_FAILED` | error | Any family: the parser, the strict render parser, layout, or theme colors reject the source or its configuration, so rendering would fail; `origin` says which (`source` or `config`). Generalizes `UNRESOLVABLE_SCHEDULE`'s seam-closing — a clean verify proves the diagram actually renders; the payload's `reason` carries the renderer error. A defect in Agentic Mermaid itself is `INTERNAL_ERROR` instead. |
300
+ | `INTERNAL_ERROR` | error | Agentic Mermaid hit an internal defect while drawing this source; it is not caused by the source. `defaultRender` says whether an ordinary render still produces output: `succeeds-unchecked` — it does, but the extra consistency checks verify runs failed, so its layout evidence cannot be trusted; `fails` — rendering throws. The payload's `reason` carries the internal error. Do not rewrite the diagram to work around it; report it with the source. |
301
+ <!-- END GENERATED: warning-table:structural -->
302
+
303
+ Tier 2 contains geometric checks. Measured `CONTENT_OCCLUDED` is an error; width-limit and route/overlap warnings are advisory: <!-- BEGIN GENERATED: warning-codes:geometric -->`NODE_OVERLAP`, `CONTENT_OCCLUDED`, `LAYOUT_LIMIT_EXCEEDED`, `ROUTE_SELF_CROSS`, `ROUTE_HITCH`, `ROUTE_UNEXPLAINED_BEND`, `ROUTE_LABEL_ON_SHARED_TRUNK`, `ROUTE_SELF_LOOP_OCCUPANCY`, `ROUTE_CONTAINER_MISANCHOR`, `ROUTE_SHAPE_MISANCHOR`, `ROUTE_STALE_AFTER_NODE_MOVE`<!-- END GENERATED: warning-codes:geometric -->.
304
+
305
+ Tier 3 covers advisory lint plus caller-selected inspect-only Brand policy: <!-- BEGIN GENERATED: warning-codes:lint -->`DUPLICATE_EDGE`, `UNREACHABLE_NODE`, `DECISION_BRANCH_UNLABELED`, `FLOW_IMBALANCE`, `COMMENT_DROPPED`, `UNSUPPORTED_SYNTAX`, `CONTENT_DROPPED_ON_ROUNDTRIP`, `EVENT_SOURCE_TYPE`, `INEFFECTIVE_CONFIG`, `LOW_CONTRAST`, `LABELS_HIDDEN`, `SCALE_RANGE_EXCLUDES_ZERO`, `BAR_RANGE_EXCLUDES_ZERO`, `VALUES_OUTSIDE_RANGE`, `BRAND_CONSTRAINT_WARNING`, `BRAND_CONSTRAINT_ERROR`<!-- END GENERATED: warning-codes:lint -->. Advisory findings do not flip `verify.ok`; `BRAND_CONSTRAINT_ERROR` does only because the caller explicitly selected `action: "error"`.
306
+
307
+ Each code's page under <https://agentic-mermaid.dev/warnings/> says what triggers it and how to clear it, and the tier tables in [`AGENT_NATIVE.md`](../AGENT_NATIVE.md#2-verifiable-rendering) describe every code; both are generated from `src/agent/warning-catalog.ts`.
298
308
 
299
309
  ## Common anti-patterns
300
310
 
@@ -31,23 +31,13 @@ When a particular body does not narrow, agents are not told it can be safely edi
31
31
 
32
32
  ## Current split
33
33
 
34
- Structured mutation is exposed for every built-in renderable family when its modeled subset narrows:
35
-
36
- - flowchart/state;
37
- - sequence (segment-preserving: `alt`/`opt`/`loop`/`par` are typed fragments with read-back and mutation ops; Note/box/critical/activate/autonumber/title ride along verbatim as opaque-block segments. Top-level message indices stay separate from fragment-message indices. Only un-segmentable input, e.g. an unbalanced `end`, falls back to whole-body opaque);
38
- - timeline;
39
- - class;
40
- - ER;
41
- - journey (simple title/section/task bodies; BUILD-15);
42
- - architecture (modeled groups/services/junctions/edges; BUILD-17);
43
- - xychart (modeled title/axes/series; BUILD-16);
44
- - pie (title/showData/slices);
45
- - quadrant (title/axes/quadrant labels/points);
46
- - gantt (title/sections/tasks, with calendar directives and click/comment/accessibility lines preserved as opaque segments).
34
+ Structured mutation is exposed for every built-in renderable family when its modeled subset narrows. `am capabilities --json` lists each family's narrower and `mutationOps`, and `describeOps(family)` gives the exact op fields; this page does not keep a second roster.
35
+
36
+ Some families are segment-preserving rather than all-or-nothing: sequence keeps `alt`/`opt`/`loop`/`par` as typed fragments (with their own read-back and mutation ops) while Note/box/critical/activate/autonumber/title ride along verbatim, and its top-level message indices stay separate from fragment-message indices; gantt keeps calendar directives and click/comment lines as verbatim segments; ER keeps ordered typed and opaque-block segments. Only input that cannot be segmented (e.g. an unbalanced `end`) falls back to a whole-body opaque body.
47
37
 
48
38
  Opaque/source-level bodies:
49
39
 
50
- - any known-family diagram that falls back to an opaque body because it contains unmodeled syntax (e.g. architecture `{group}` boundary modifiers, accTitle/accDescr, malformed pie entries, out-of-range quadrant coordinates, or un-segmentable sequence/gantt syntax).
40
+ - any known-family diagram that falls back to an opaque body because it contains unmodeled syntax (e.g. architecture `{group}` boundary modifiers, malformed pie entries, out-of-range quadrant coordinates, or un-segmentable sequence/gantt syntax).
51
41
 
52
42
  For source-level bodies, the safe loop is:
53
43
 
@@ -57,7 +47,73 @@ For source-level bodies, the safe loop is:
57
47
  4. verify;
58
48
  5. only then return or serialize.
59
49
 
60
- `am mutate` should return `UNSUPPORTED_FAMILY` for those bodies.
50
+ Ordinary `am mutate` returns `UNSUPPORTED_FAMILY` for those bodies. Explicit
51
+ source-preserving mutation supports four bounded operations on opaque inputs:
52
+
53
+ - Class `add_member`: append an ordinary attribute or method declaration.
54
+ - Class `remove_member`: remove an unambiguous member that owns one complete
55
+ physical line, without comments or directives. The index follows authored
56
+ member order, including annotations; selecting an annotation is refused.
57
+ - Flowchart `set_label`: append a label override for an existing native node.
58
+ - Flowchart `rename_node`: replace owned lexical node identities in declarations,
59
+ endpoints and group membership. Class assignments, styles, click/href
60
+ dependencies and colliding group identities are refused.
61
+
62
+ These edits retain bytes outside the owned edit ranges and compare the complete
63
+ native read-back with the requested change before committing. Unsupported or
64
+ ambiguous ownership, dependency changes and semantic mismatches reject the edit
65
+ atomically. A repeated label with no semantic change retains the exact source,
66
+ including its final newline spelling.
67
+
68
+ Rename does not rewrite dependent directives. A changing rename refuses sources
69
+ with any `class`, `style`, `click` or `href` statement, even when it names another
70
+ node. An explicit ID-equal label such as `A[A]` also refuses the change because
71
+ the lexical edit would retain a label that ordinary rename changes. These
72
+ refusals keep the edit within the scanner's proven ownership.
73
+
74
+ Appending preserves the complete previous source as a prefix: each changing
75
+ Flowchart label adds an override, and each Class member addition adds a reopened
76
+ class block. Repeated edits therefore grow the document; this mode does not
77
+ compact earlier declarations. Member removal and node rename instead replace
78
+ only their owned ranges. Each changing edit still reparses the complete public
79
+ diagram and rebuilds its source spans.
80
+
81
+ ```ts
82
+ const edited = mutatePreservingSource(diagram, {
83
+ kind: 'set_label', target: 'A', label: 'Reviewed',
84
+ })
85
+ if (edited.ok) {
86
+ const verification = verifyMermaid(edited.value.diagram)
87
+ if (!verification.ok) throw new Error('verify failed')
88
+ // Inspect warnings and save exact source; do not canonicalize it.
89
+ await save(edited.value.source)
90
+ }
91
+ ```
92
+
93
+ The result is `{ source, diagram }`. Its exact `source` is the save artifact;
94
+ the ordinary serializer may normalize the final newline. The diagram remains
95
+ opaque and retains its portability warning. This API does not make invalid
96
+ Mermaid syntax portable, admit every member/label payload, or expose opaque
97
+ bodies through structural narrowers. Structured inputs should use `mutate`;
98
+ the default mutation mode retains its structured-only contract.
99
+
100
+ The same explicit mode is available through the workflow surfaces:
101
+
102
+ - Library batches: `applyOps({ source, ops, mode: 'source-preserving' })`.
103
+ - CLI: `am mutate diagram.mmd --op '<JSON>' --preserve-source`; JSONL mutation
104
+ requests use `preserveSource: true`.
105
+ - Declarative MCP `mutate`: pass `mode: 'source-preserving'` with `source` and
106
+ `ops`.
107
+ - Code Mode: `mermaid.mutatePreservingSource(diagram, op)` returns the same
108
+ `{ source, diagram }` result as the library. Returning that successful result
109
+ or its diagram produces a verified envelope with the exact edited source.
110
+ - Editor adapter: programmatic `applyOps(source, ops, 'source-preserving')`
111
+ queues the edit in the persistent worker; it does not add an editor control.
112
+
113
+ Batch success includes `mode: 'source-preserving'` and verification diagnostics.
114
+ A failed batch emits no edited source, even when earlier operations succeeded.
115
+ Builders have no original source and do not accept this mode. These entrypoints
116
+ do not remove the portability warning or promise portable Mermaid export.
61
117
 
62
118
  ## Why not every syntax construct?
63
119
 
@@ -102,3 +158,18 @@ An opaque fallback path can become structurally mutable only when a scoped imple
102
158
  6. update CLI/MCP/capabilities/docs together.
103
159
 
104
160
  Until then, opaque/source-level editing is the honest behavior for that body.
161
+
162
+
163
+ ## Comments and transaction boundaries
164
+
165
+ Flowchart and State body comments are retained in metadata beside semantic
166
+ statement identities. Serialization re-emits safe standalone `%%` comments;
167
+ inline placement may normalize. If an edit removes an anchor, its comment is
168
+ retained at the end rather than discarded. Leading wrapper bytes retain their
169
+ existing verbatim contract. Other families keep their existing segmented/opaque
170
+ policies and report any known loss.
171
+
172
+ Declarative edits, CLI batches, and builders apply checked operations to private
173
+ intermediate bodies, then serialize and reparse once at commit. A failed operation
174
+ returns its index and emits no edited source; the original diagram stays untouched.
175
+ Single public `mutate` calls retain parser-closure checks at each call boundary.
@@ -16,7 +16,7 @@ What it demonstrates:
16
16
  - CLI path: `am mutate auth-flow.mmd --ops ops.json --json` applies the same mutation batch and verifies before emitting source.
17
17
  - The example asserts both channels produce byte-identical Mermaid source for multiple non-trivial cases: an Auth Flow with decisions/feedback loops and an Order Domain ER diagram.
18
18
 
19
- This is the intended local equivalence story: MCP Code Mode and CLI/library can create the same diagram. The local non-Code-Mode helpers remain narrow (`describe_sdk`, `render_png`, `describe`); `describe_sdk` returns one family's version-matched mutation schema on demand. The hosted `/mcp` endpoint additionally offers direct pure render/verify/describe tools plus declarative `mutate`/`build` for bounded structured edits.
19
+ This is the intended local equivalence story: MCP Code Mode and CLI/library can create the same diagram. Local MCP also exposes declarative `mutate`/`build` and the pure helpers `describe_sdk`, `render_png`, and `describe`; `describe_sdk` returns one family's version-matched mutation schema on demand. The hosted `/mcp` endpoint additionally offers direct pure render/verify tools; its declarative edits share the local implementation with a 64 KB input limit.
20
20
 
21
21
  ## Improve a diagram through an agent loop
22
22