agentic-mermaid 0.1.0 → 0.1.2

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 (333) hide show
  1. package/CHANGELOG.md +149 -4
  2. package/LICENSES/Apache-2.0.txt +202 -0
  3. package/README.md +25 -32
  4. package/THIRD_PARTY_NOTICES.md +29 -0
  5. package/assets/fonts/FONT-LICENSES.md +9 -5
  6. package/assets/fonts/Inter-Bold.ttf +0 -0
  7. package/assets/fonts/Inter-Medium.ttf +0 -0
  8. package/assets/fonts/Inter-Regular.ttf +0 -0
  9. package/assets/fonts/Inter-SemiBold.ttf +0 -0
  10. package/dist/agent-core.d.ts +463 -0
  11. package/dist/agent-core.js +397 -0
  12. package/dist/agent.d.ts +81 -1822
  13. package/dist/agent.js +336 -36839
  14. package/dist/agentic-mermaid-mcp.js +7 -37908
  15. package/dist/am.js +33638 -36261
  16. package/dist/chunk-4QECACIA.js +4702 -0
  17. package/dist/chunk-CDPKJ2BQ.js +37 -0
  18. package/dist/chunk-QKDLMOJJ.js +3487 -0
  19. package/dist/chunk-WI35L7IR.js +615 -0
  20. package/dist/chunk-WN3YDOBG.js +149 -0
  21. package/dist/chunk-ZYMMKQ3I.js +62637 -0
  22. package/dist/index-D54dqSdC.d.ts +6777 -0
  23. package/dist/index.d.ts +1 -1
  24. package/dist/index.js +310 -32836
  25. package/dist/mcp-cli-SBQSTJFC.js +17 -0
  26. package/docs/README.md +14 -6
  27. package/docs/schemas/style-spec.schema.json +1221 -30
  28. package/examples/styles/catalog.json +54 -0
  29. package/examples/styles/cloudflare-workers-inspired-prototype.mmd +9 -0
  30. package/examples/styles/cloudflare-workers-inspired-prototype.style.json +110 -0
  31. package/examples/styles/cupertino-prototype.mmd +10 -0
  32. package/examples/styles/cupertino-prototype.style.json +63 -0
  33. package/examples/styles/mid-century-report.style.json +2 -2
  34. package/examples/styles/star-chart-atlas.style.json +2 -1
  35. package/examples/styles/transit-route-map.style.json +2 -2
  36. package/examples/styles/vercel-inspired-prototype.mmd +6 -0
  37. package/examples/styles/vercel-inspired-prototype.style.json +87 -0
  38. package/package.json +70 -43
  39. package/server.json +41 -0
  40. package/skills/agentic-mermaid-diagram-workflow/SKILL.md +17 -36
  41. package/skills/agentic-mermaid-diagram-workflow/references/cli.md +4 -5
  42. package/skills/agentic-mermaid-diagram-workflow/references/code-mode.md +15 -31
  43. package/skills/agentic-mermaid-diagram-workflow/references/sequence.md +10 -14
  44. package/skills/agentic-mermaid-live-editor/SKILL.md +100 -206
  45. package/AGENT_NATIVE.md +0 -602
  46. package/Instructions_for_agents.md +0 -83
  47. package/TODO.md +0 -662
  48. package/assets/hero.png +0 -0
  49. package/dist/index-x2Cj1dVv.d.ts +0 -1089
  50. package/docs/agent-api-cookbook.md +0 -308
  51. package/docs/agent-mutation-policy.md +0 -104
  52. package/docs/agent-workflow-examples.md +0 -46
  53. package/docs/api.md +0 -203
  54. package/docs/ascii.md +0 -103
  55. package/docs/assets/improvements/box-start-connector.png +0 -0
  56. package/docs/assets/improvements/comment-dropped-lint.png +0 -0
  57. package/docs/assets/improvements/er-content-loss.png +0 -0
  58. package/docs/assets/improvements/fan-in-trunks.png +0 -0
  59. package/docs/assets/improvements/gantt-family.png +0 -0
  60. package/docs/assets/improvements/gantt-milestone-clamp.png +0 -0
  61. package/docs/assets/improvements/gantt-verify-seam.png +0 -0
  62. package/docs/assets/improvements/subgraph-container-edges.png +0 -0
  63. package/docs/assets/improvements/wrapper-frontmatter.png +0 -0
  64. package/docs/assets/improvements/wrapper-init-directive.png +0 -0
  65. package/docs/assets/improvements/wrapper-leading-comment.png +0 -0
  66. package/docs/assets/style-cookbook/mid-century-report.png +0 -0
  67. package/docs/assets/style-cookbook/star-chart-atlas.png +0 -0
  68. package/docs/assets/style-cookbook/transit-route-map.png +0 -0
  69. package/docs/comparison.md +0 -94
  70. package/docs/config.md +0 -105
  71. package/docs/contributing/adding-diagram-types.md +0 -144
  72. package/docs/contributing/diagram-family-citizenship.matrix.json +0 -2127
  73. package/docs/contributing/diagram-family-citizenship.md +0 -82
  74. package/docs/contributing/harvesting-upstream-tests.md +0 -126
  75. package/docs/contributing/lessons-learned.md +0 -276
  76. package/docs/contributing/releasing.md +0 -71
  77. package/docs/contributing/visual-review-evidence.md +0 -53
  78. package/docs/custom-style-cookbook.md +0 -154
  79. package/docs/design/families/README.md +0 -26
  80. package/docs/design/families/architecture-beta.md +0 -48
  81. package/docs/design/families/flowchart-parser-conformance.md +0 -22
  82. package/docs/design/families/gantt-research.md +0 -137
  83. package/docs/design/families/gantt.md +0 -329
  84. package/docs/design/families/journey-agentic-cards-before.png +0 -0
  85. package/docs/design/families/journey-mermaid-classic-implementation.png +0 -0
  86. package/docs/design/families/journey-mermaid-classic-prototype.png +0 -0
  87. package/docs/design/families/journey-mermaid-classic-prototype.svg +0 -163
  88. package/docs/design/families/journey-mermaid-classic-prototype.svg.png +0 -0
  89. package/docs/design/families/journey-migration-parity.md +0 -433
  90. package/docs/design/families/journey-usage-research.md +0 -423
  91. package/docs/design/families/journey.md +0 -125
  92. package/docs/design/families/xychart.md +0 -85
  93. package/docs/design/system/README.md +0 -45
  94. package/docs/design/system/abstraction-audit.md +0 -224
  95. package/docs/design/system/abstraction-recommendations.md +0 -655
  96. package/docs/design/system/architecture.mmd +0 -29
  97. package/docs/design/system/architecture.svg +0 -137
  98. package/docs/design/system/layout-guarantees-and-robustness.md +0 -351
  99. package/docs/design/system/layout-rubric.md +0 -138
  100. package/docs/design/system/route-contracts.md +0 -848
  101. package/docs/design/system/source-preservation-ladder.md +0 -52
  102. package/docs/design/system/styles-rollout.md +0 -216
  103. package/docs/design/system/ugly-layouts.md +0 -119
  104. package/docs/diagram-families.md +0 -193
  105. package/docs/features.md +0 -147
  106. package/docs/fork-differences.md +0 -130
  107. package/docs/getting-started.md +0 -175
  108. package/docs/issue-derived-test-cases.md +0 -156
  109. package/docs/layout-characterization/README.md +0 -245
  110. package/docs/layout-characterization/contact-sheet-families.md +0 -496
  111. package/docs/layout-characterization/contact-sheet.md +0 -638
  112. package/docs/layout-characterization/properties.md +0 -281
  113. package/docs/layout-characterization/visual-quality.md +0 -160
  114. package/docs/layout-characterization/visual-snapshots/architecture.svg +0 -79
  115. package/docs/layout-characterization/visual-snapshots/class.svg +0 -60
  116. package/docs/layout-characterization/visual-snapshots/er.svg +0 -61
  117. package/docs/layout-characterization/visual-snapshots/flowchart.svg +0 -58
  118. package/docs/layout-characterization/visual-snapshots/gantt.svg +0 -52
  119. package/docs/layout-characterization/visual-snapshots/journey.svg +0 -118
  120. package/docs/layout-characterization/visual-snapshots/pie.svg +0 -36
  121. package/docs/layout-characterization/visual-snapshots/quadrant.svg +0 -47
  122. package/docs/layout-characterization/visual-snapshots/sequence.svg +0 -59
  123. package/docs/layout-characterization/visual-snapshots/state.svg +0 -52
  124. package/docs/layout-characterization/visual-snapshots/timeline.svg +0 -64
  125. package/docs/layout-characterization/visual-snapshots/xychart.svg +0 -97
  126. package/docs/mcp-code-mode-rationale.md +0 -101
  127. package/docs/mcp-http-transport.md +0 -223
  128. package/docs/mermaid-layout-complaints.md +0 -837
  129. package/docs/mutation-testing.md +0 -206
  130. package/docs/project/divergences.md +0 -98
  131. package/docs/project/dogfooding-docs-strategy.md +0 -66
  132. package/docs/project/hosted-mcp-cloudflare-plan.md +0 -338
  133. package/docs/project/lessons-learned.md +0 -1019
  134. package/docs/project/remove-role-styling-plan.md +0 -176
  135. package/docs/quality.md +0 -212
  136. package/docs/react.md +0 -97
  137. package/docs/style-authoring.md +0 -133
  138. package/docs/testing-strategy.md +0 -335
  139. package/docs/theming.md +0 -162
  140. package/examples/agent-improve-auth-flow.ts +0 -206
  141. package/examples/agent-loop.ts +0 -53
  142. package/examples/mcp-vs-cli-complex-diagrams.ts +0 -133
  143. package/llms.txt +0 -104
  144. package/skill-evals/README.md +0 -77
  145. package/skill-evals/fixtures/architecture-cache/input.mmd +0 -5
  146. package/skill-evals/fixtures/class-payment/input.mmd +0 -4
  147. package/skill-evals/fixtures/er-orders/input.mmd +0 -10
  148. package/skill-evals/fixtures/flowchart-cache/input.mmd +0 -3
  149. package/skill-evals/fixtures/gantt-release/input.mmd +0 -7
  150. package/skill-evals/fixtures/journey-checkout/input.mmd +0 -6
  151. package/skill-evals/fixtures/pie-exports/input.mmd +0 -5
  152. package/skill-evals/fixtures/quadrant-priorities/input.mmd +0 -11
  153. package/skill-evals/fixtures/sequence-retry/input.mmd +0 -8
  154. package/skill-evals/fixtures/state-lifecycle/input.mmd +0 -5
  155. package/skill-evals/fixtures/timeline-release/input.mmd +0 -6
  156. package/skill-evals/fixtures/xychart-growth/input.mmd +0 -5
  157. package/skill-evals/shared-benchmark.json +0 -510
  158. package/src/agent/analyze.ts +0 -157
  159. package/src/agent/apply.ts +0 -146
  160. package/src/agent/architecture-body.ts +0 -458
  161. package/src/agent/certificates.ts +0 -110
  162. package/src/agent/class-body.ts +0 -319
  163. package/src/agent/core.ts +0 -207
  164. package/src/agent/create.ts +0 -106
  165. package/src/agent/describe.ts +0 -364
  166. package/src/agent/er-body.ts +0 -224
  167. package/src/agent/facts.ts +0 -337
  168. package/src/agent/families-builtin.ts +0 -934
  169. package/src/agent/families.ts +0 -232
  170. package/src/agent/family-layouts.ts +0 -826
  171. package/src/agent/flowchart-body.ts +0 -372
  172. package/src/agent/flowchart-unsupported.ts +0 -243
  173. package/src/agent/gantt-body.ts +0 -495
  174. package/src/agent/index.ts +0 -10
  175. package/src/agent/journey-body.ts +0 -414
  176. package/src/agent/label-metrics.ts +0 -28
  177. package/src/agent/layout-to-rendered.ts +0 -63
  178. package/src/agent/mutate.ts +0 -97
  179. package/src/agent/mutation-ops.ts +0 -51
  180. package/src/agent/op-schema.ts +0 -439
  181. package/src/agent/parse.ts +0 -223
  182. package/src/agent/pie-body.ts +0 -270
  183. package/src/agent/png.ts +0 -117
  184. package/src/agent/quadrant-body.ts +0 -336
  185. package/src/agent/quality.ts +0 -363
  186. package/src/agent/readability-audit.ts +0 -92
  187. package/src/agent/rendered-route-audit.ts +0 -61
  188. package/src/agent/sequence-body.ts +0 -345
  189. package/src/agent/serialize.ts +0 -214
  190. package/src/agent/state-body.ts +0 -589
  191. package/src/agent/structural-count.ts +0 -150
  192. package/src/agent/timeline-body.ts +0 -280
  193. package/src/agent/trace-log.ts +0 -43
  194. package/src/agent/types.ts +0 -979
  195. package/src/agent/verify.ts +0 -571
  196. package/src/agent/xychart-body.ts +0 -472
  197. package/src/architecture/config.ts +0 -282
  198. package/src/architecture/layout.ts +0 -496
  199. package/src/architecture/parser.ts +0 -375
  200. package/src/architecture/renderer.ts +0 -611
  201. package/src/architecture/types.ts +0 -113
  202. package/src/ascii/ansi.ts +0 -423
  203. package/src/ascii/architecture.ts +0 -210
  204. package/src/ascii/canvas.ts +0 -443
  205. package/src/ascii/class-diagram.ts +0 -697
  206. package/src/ascii/converter.ts +0 -475
  207. package/src/ascii/draw.ts +0 -1693
  208. package/src/ascii/edge-bundling.ts +0 -328
  209. package/src/ascii/edge-routing.ts +0 -330
  210. package/src/ascii/er-diagram.ts +0 -439
  211. package/src/ascii/gantt.ts +0 -276
  212. package/src/ascii/grid.ts +0 -747
  213. package/src/ascii/index.ts +0 -196
  214. package/src/ascii/journey.ts +0 -189
  215. package/src/ascii/meta.ts +0 -244
  216. package/src/ascii/multiline-utils.ts +0 -80
  217. package/src/ascii/pathfinder.ts +0 -301
  218. package/src/ascii/pie.ts +0 -67
  219. package/src/ascii/quadrant.ts +0 -158
  220. package/src/ascii/reverse.ts +0 -216
  221. package/src/ascii/sequence.ts +0 -499
  222. package/src/ascii/shapes/circle.ts +0 -27
  223. package/src/ascii/shapes/corners.ts +0 -143
  224. package/src/ascii/shapes/diamond.ts +0 -27
  225. package/src/ascii/shapes/hexagon.ts +0 -27
  226. package/src/ascii/shapes/index.ts +0 -106
  227. package/src/ascii/shapes/rectangle.ts +0 -168
  228. package/src/ascii/shapes/rounded.ts +0 -27
  229. package/src/ascii/shapes/special.ts +0 -332
  230. package/src/ascii/shapes/stadium.ts +0 -110
  231. package/src/ascii/shapes/state.ts +0 -192
  232. package/src/ascii/shapes/types.ts +0 -73
  233. package/src/ascii/timeline.ts +0 -128
  234. package/src/ascii/types.ts +0 -312
  235. package/src/ascii/validate.ts +0 -120
  236. package/src/ascii/width.ts +0 -81
  237. package/src/ascii/xychart.ts +0 -919
  238. package/src/browser.ts +0 -29
  239. package/src/class/layout.ts +0 -240
  240. package/src/class/parser.ts +0 -332
  241. package/src/class/renderer.ts +0 -638
  242. package/src/class/types.ts +0 -129
  243. package/src/cli/agent-instructions.ts +0 -1
  244. package/src/cli/am-bin.ts +0 -6
  245. package/src/cli/exit-codes.ts +0 -18
  246. package/src/cli/index.ts +0 -1117
  247. package/src/cli/init-agent.ts +0 -147
  248. package/src/color-resolver.ts +0 -152
  249. package/src/elk-instance.ts +0 -114
  250. package/src/er/layout.ts +0 -187
  251. package/src/er/parser.ts +0 -226
  252. package/src/er/renderer.ts +0 -792
  253. package/src/er/types.ts +0 -99
  254. package/src/font-manifest.ts +0 -27
  255. package/src/gantt/layout.ts +0 -365
  256. package/src/gantt/parser.ts +0 -282
  257. package/src/gantt/pipeline.ts +0 -27
  258. package/src/gantt/renderer.ts +0 -414
  259. package/src/gantt/schedule.ts +0 -513
  260. package/src/gantt/types.ts +0 -255
  261. package/src/index.ts +0 -368
  262. package/src/journey/layout.ts +0 -520
  263. package/src/journey/parser.ts +0 -218
  264. package/src/journey/renderer.ts +0 -811
  265. package/src/journey/types.ts +0 -144
  266. package/src/layout/geometry.ts +0 -182
  267. package/src/layout/pass.ts +0 -142
  268. package/src/layout/passes/index.ts +0 -3916
  269. package/src/layout-engine.ts +0 -1565
  270. package/src/layout-rubric.ts +0 -659
  271. package/src/mcp/artifacts.ts +0 -137
  272. package/src/mcp/dynamic-harness.ts +0 -31
  273. package/src/mcp/dynamic-modules.d.ts +0 -7
  274. package/src/mcp/facade.ts +0 -608
  275. package/src/mcp/harness-runtime.ts +0 -203
  276. package/src/mcp/hosted-server.ts +0 -468
  277. package/src/mcp/mcp-bin.ts +0 -3
  278. package/src/mcp/mcp-cli.ts +0 -82
  279. package/src/mcp/protocol.ts +0 -13
  280. package/src/mcp/sandbox.ts +0 -195
  281. package/src/mcp/sdk-decl.ts +0 -387
  282. package/src/mcp/server.ts +0 -362
  283. package/src/mcp/tool-surface.ts +0 -146
  284. package/src/mermaid-source.ts +0 -655
  285. package/src/multiline-utils.ts +0 -228
  286. package/src/parser.ts +0 -1031
  287. package/src/pie/layout.ts +0 -168
  288. package/src/pie/parser.ts +0 -136
  289. package/src/pie/renderer.ts +0 -234
  290. package/src/pie/types.ts +0 -82
  291. package/src/quadrant/layout.ts +0 -191
  292. package/src/quadrant/parser.ts +0 -183
  293. package/src/quadrant/renderer.ts +0 -322
  294. package/src/quadrant/types.ts +0 -113
  295. package/src/render-family-hooks.ts +0 -244
  296. package/src/renderer.ts +0 -1099
  297. package/src/route-contracts.ts +0 -2723
  298. package/src/scene/backend.ts +0 -76
  299. package/src/scene/fidelity.ts +0 -183
  300. package/src/scene/hybrid-backend.ts +0 -174
  301. package/src/scene/ir.ts +0 -181
  302. package/src/scene/marks.ts +0 -127
  303. package/src/scene/rough-backend.ts +0 -378
  304. package/src/scene/seed.ts +0 -46
  305. package/src/scene/style-registry.ts +0 -556
  306. package/src/sequence/layout.ts +0 -456
  307. package/src/sequence/parser.ts +0 -255
  308. package/src/sequence/renderer.ts +0 -604
  309. package/src/sequence/types.ts +0 -154
  310. package/src/shape-clipping.ts +0 -351
  311. package/src/shared/accessibility-directives.ts +0 -22
  312. package/src/shared/batched.ts +0 -61
  313. package/src/shared/color-math.ts +0 -72
  314. package/src/shared/svg-a11y.ts +0 -29
  315. package/src/shared/syntax-error.ts +0 -17
  316. package/src/shared/unicode-ranges.ts +0 -135
  317. package/src/styles.ts +0 -318
  318. package/src/svg-paths.ts +0 -28
  319. package/src/text-metrics.ts +0 -248
  320. package/src/theme.ts +0 -639
  321. package/src/timeline/layout.ts +0 -381
  322. package/src/timeline/parser.ts +0 -215
  323. package/src/timeline/renderer.ts +0 -538
  324. package/src/timeline/types.ts +0 -105
  325. package/src/types.ts +0 -454
  326. package/src/website-worker-modules.d.ts +0 -18
  327. package/src/xychart/axis-utils.ts +0 -109
  328. package/src/xychart/colors.ts +0 -124
  329. package/src/xychart/config.ts +0 -88
  330. package/src/xychart/layout.ts +0 -656
  331. package/src/xychart/parser.ts +0 -504
  332. package/src/xychart/renderer.ts +0 -640
  333. package/src/xychart/types.ts +0 -282
@@ -2,11 +2,14 @@
2
2
 
3
3
  The `.ttf` files in this directory ship inside the `agentic-mermaid` npm
4
4
  package so PNG rasterization (`renderMermaidPNG`) is deterministic and
5
- offline: DejaVu Sans is the default face, and the four OFL faces are the
6
- typefaces referenced by the built-in styles (hand-drawn, excalidraw,
7
- watercolor → Caveat; pen-and-ink, tufte → EB Garamond; freehand →
8
- Architects Daughter; blueprint → Share Tech Mono). Custom styles that
9
- reference other families can supply them via the `fontDirs` PNG option.
5
+ offline: Inter (weights 400/500/600/700 — the weights the SVG output
6
+ requests) is the default face and the family the text-metrics model is
7
+ calibrated for; DejaVu Sans serves as the per-glyph fallback for symbols
8
+ Inter lacks; and the remaining OFL faces are the typefaces referenced by
9
+ the built-in styles (hand-drawn, excalidraw, watercolor → Caveat;
10
+ pen-and-ink, tufte → EB Garamond; freehand → Architects Daughter;
11
+ blueprint → Share Tech Mono). Custom styles that reference other families
12
+ can supply them via the `fontDirs` PNG option.
10
13
 
11
14
  ## OFL-1.1 faces
12
15
 
@@ -16,6 +19,7 @@ required by OFL condition 2.
16
19
 
17
20
  | File | Typeface | Copyright / Reserved Font Name | Source |
18
21
  |---|---|---|---|
22
+ | `Inter-Regular.ttf`, `Inter-Medium.ttf`, `Inter-SemiBold.ttf`, `Inter-Bold.ttf` | Inter (v4.001 statics, weights 400/500/600/700) | Copyright 2016 The Inter Project Authors (https://github.com/rsms/inter) | fonts.google.com/specimen/Inter |
19
23
  | `Caveat.ttf` | Caveat | Copyright 2014 The Caveat Project Authors (https://github.com/googlefonts/caveat) | fonts.google.com/specimen/Caveat |
20
24
  | `EBGaramond.ttf` | EB Garamond | Copyright 2017 The EB Garamond Project Authors (https://github.com/octaviopardo/EBGaramond12) | fonts.google.com/specimen/EB+Garamond |
21
25
  | `ArchitectsDaughter.ttf` | Architects Daughter | Copyright (c) 2010, Kimberly Geswein (kimberlygeswein.com) | fonts.google.com/specimen/Architects+Daughter |
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,463 @@
1
+ import { P as ParsedDiagram, d7 as Result, cl as ParseError, es as ValidDiagramPayload, eq as ValidDiagram, aP as ExtensionDiagramBody, c5 as MutationError, fV as Direction, bv as FlowchartMutationOp, bw as FlowchartValidDiagram, dP as StateMutationOp, dS as StateValidDiagram, dE as SequenceMutationOp, dG as SequenceValidDiagram, ee as TimelineMutationOp, eh as TimelineValidDiagram, a7 as ClassMutationOp, ac as ClassValidDiagram, aL as ErMutationOp, aN as ErValidDiagram, bM as JourneyMutationOp, bP as JourneyValidDiagram, n as ArchitectureMutationOp, q as ArchitectureValidDiagram, eD as XyChartMutationOp, eF as XyChartValidDiagram, co as PieMutationOp, cq as PieValidDiagram, cJ as QuadrantMutationOp, cL as QuadrantValidDiagram, bB as GanttMutationOp, bE as GanttValidDiagram, c2 as MindmapMutationOp, c3 as MindmapValidDiagram, bG as GitGraphMutationOp, bH as GitGraphValidDiagram, cV as RadarMutationOp, cW as RadarValidDiagram, aA as DiagramKind, f as AnyMutationOp, c4 as MutableValidDiagram, fW as MermaidEdge, eu as VerifyResult, et as VerifyOptions, d0 as RenderedLayout, bQ as LayoutRouteCertificate, bd as FamilyConformanceReport, bf as FamilyDescriptor, bi as FamilyId, fX as PositionedDiagram, bm as FamilyPositionedProjectionOptions, bn as FamilyPositionedView, d4 as RenderedRegionKind, fY as TerminalProjectionDiagnosticCode, D as DiagramActionRecord, A as AsciiRenderOptions, ay as DiagramAnalysis, R as RenderOptions, b as RenderRequestReceipt, fZ as renderMermaidASCII$1, c$ as RenderedAscii, f_ as renderMermaidSVG$1, f$ as RenderedSvg } from './index-D54dqSdC.js';
2
+ export { e as Accessibility, g as AnyPort, h as ArchitectureBody, i as ArchitectureEdge, j as ArchitectureEndpoint, k as ArchitectureEndpointBoundary, l as ArchitectureGroup, m as ArchitectureJunction, o as ArchitectureService, p as ArchitectureSide, r as ArchitectureVisualOverrides, s as AsciiRenderColorMode, t as AsciiWidthError, u as AsciiWidthErrorReason, B as BACKEND_CONFORMANCE_CHECK_IDS, v as BACKEND_CONFORMANCE_FIXTURE_ID, w as BACKEND_CONFORMANCE_VERSION, x as BINDABLE_ROLE_STYLE_PROPERTIES, y as BINDABLE_SCENE_ROLES, z as BRAND_CONSTRAINT_DESCRIPTORS, C as BRAND_CONSTRAINT_KINDS, E as BUILTIN_FAMILY_METADATA, F as BUILTIN_FAMILY_METADATA_COVERS_DIAGRAM_KIND, G as BUILTIN_SCENE_ROLE_TRAITS, I as BackendCapabilityConformanceResult, J as BackendCapabilityConformanceStatus, K as BackendConformanceCheck, L as BackendConformanceCheckId, M as BackendConformanceReport, N as BackendDescriptor, O as BackendRegistrationOptions, Q as BindableSceneRole, S as BrandConstraint, T as BrandConstraintAction, U as BrandConstraintKind, V as BuiltinFamilyId, W as BuiltinFamilyMetadata, X as CAPABILITY_NEGOTIATION_VERSION, Y as CORE_CAPABILITY_OFFERS, Z as CORE_SCENE_FEATURES, _ as CORE_SCENE_OPERATIONS, $ as CORE_SCENE_PRIMITIVES, a0 as CapabilityDecision, a1 as CapabilityId, a2 as CapabilityOffer, a3 as CapabilityRequirement, a4 as CapabilityRequirementLevel, a5 as CapabilityResolution, a6 as ClassBody, a8 as ClassNode, a9 as ClassNote, aa as ClassRelation, ab as ClassRelationKind, ad as CliRenderTransport, ae as CodeModeRenderTransport, af as ConnectorContourSemantics, ag as ConnectorEndpoints, ah as ConnectorGeometry, ai as ConnectorHitGeometry, aj as ConnectorLabelDescriptor, ak as ConnectorMark, al as ConnectorRelationship, am as ConnectorRoute, an as ConnectorStroke, ao as ConnectorSubpath, ap as ConnectorTerminalLabelProjection, aq as ConnectorTerminalMarkerPlacement, ar as ConnectorTerminalMarkerProjection, as as ConnectorTerminalProjection, at as ConnectorTerminalStrokeLoss, au as DEFAULT_LABEL_CHAR_CAP, av as DefaultBackend, aw as DiagramActionKind, ax as DiagramActionSecurity, az as DiagramBody, aB as DiamondFacet, aC as EXACT_ROLE_STYLE_CONTRACT, aD as EXACT_STYLE_SCENE_ROLES, aE as EXTERNAL_SCENE_API_VERSION, aF as EdgeId, aG as EdgeRouteCertificate, aH as ErAttribute, aI as ErBody, aJ as ErCardinality, aK as ErEntity, aM as ErRelation, aO as ExactStyleSceneRole, aQ as ExtensionIdentity, aR as ExtensionValidDiagram, aS as ExternalFamilyId, aT as ExternalSceneConnector, aU as ExternalSceneConnectorGeometry, aV as ExternalSceneConnectorLabel, aW as ExternalSceneContainer, aX as ExternalSceneDataMark, aY as ExternalSceneDocument, aZ as ExternalSceneGeometry, a_ as ExternalSceneInput, a$ as ExternalSceneMarker, b0 as ExternalSceneNode, b1 as ExternalSceneNodeBase, b2 as ExternalSceneShape, b3 as ExternalSceneText, b4 as ExtractedLabel, b5 as FAMILY_CAPABILITY_COLUMNS, b6 as FAMILY_CONFORMANCE_MAX_EXAMPLE_BYTES, b7 as FAMILY_CONFORMANCE_VERSION, b8 as FAMILY_DESCRIPTOR_CONTRACT_VERSION, b9 as FamilyCapability, ba as FamilyCapabilityConformanceResult, bb as FamilyCapabilityEvidence, bc as FamilyCapabilityState, be as FamilyConformanceStatus, bg as FamilyDetectionDiagnostic, bh as FamilyEdgeRouteCertificate, bj as FamilyOperations, bk as FamilyParsedBody, bl as FamilyPositionedProjectionContext, bo as FamilyRouteCertificate, bp as FamilyScenePositivePrimitive, bq as FamilyScenePrimitiveApplicability, br as FamilyScenePrimitiveEvidence, bs as FamilySceneRolePrimitiveDeclaration, bt as FeedbackEdgeAnalysis, bu as Finite, bx as GanttBody, by as GanttBodySection, bz as GanttBodyTask, bA as GanttBodyTaskTag, bC as GanttScheduleAnalysisSummary, bD as GanttStatement, bF as GitGraphBody, bI as GroupId, bJ as HOSTED_FONT_RESOURCES, H as HostBackendPolicy, bK as InitDirective, bL as JourneyBody, bN as JourneySection, bO as JourneyTask, bR as LayoutRouteClass, bS as LayoutWarning, bT as LibraryRenderTransport, bU as MAX_HOSTED_PNG_BYTES, bV as MAX_HOSTED_PNG_PIXELS, bW as MAX_PNG_FONT_DIRECTORIES, bX as MAX_PNG_FONT_DIRECTORY_LENGTH, bY as MAX_PNG_PIXELS, bZ as MAX_PNG_RASTER_DIMENSION, b_ as MarkerDescriptor, b$ as MermaidFamilyClassification, c0 as MermaidFamilyDetectionError, c1 as MindmapBody, c6 as NATIVE_PNG_HOST_ONLY_OPTION_FIELDS, c7 as NATIVE_PNG_OUTPUT_POLICY_FIELDS, c8 as NativePngHostOnlyOptionField, c9 as NativePngOutputPolicyField, ca as NodeId, cb as PNG_DEFAULT_FONT_FAMILY, cc as PNG_DEFAULT_SCALE, cd as PNG_FONT_SOURCES, ce as PNG_NAPI_RUNTIME, cf as PNG_OUTPUT_OPTION_FIELDS, cg as PNG_OUTPUT_OPTION_FIELD_DESCRIPTORS, ch as PNG_OUTPUT_POLICY_VERSION, ci as PNG_WASM_RUNTIME, cj as PORTABLE_PNG_OUTPUT_OPTION_FIELDS, ck as PRIMITIVE_REALIZATIONS, cm as ParticipantId, cn as PieBody, cp as PieSlice, cr as PngFitTo, cs as PngFontSource, ct as PngOutputOptionField, cu as PngOutputOptionFieldDescriptor, cv as PngOutputOptionInputKind, cw as PngOutputOptionPolicyState, cx as PngOutputOptionReceiptState, cy as PngOutputOptionScope, a as PngOutputPolicyInput, cz as PngRasterDimensions, c as PngRuntimeProvenance, cA as PortSemanticRole, cB as PortSide, cC as PortablePngOutputOptionField, cD as PortablePngOutputOptions, cE as PreservedDiagramBody, cF as PreservedSourceSpans, cG as PreservedValidDiagram, cH as QuadrantAxis, cI as QuadrantBody, cK as QuadrantPoint, cM as RENDER_CONTRACT_VERSION, cN as RENDER_OUTPUTS, cO as RENDER_OUTPUT_DESCRIPTORS, cP as RESOURCE_MANIFEST, cQ as RESOURCE_MANIFEST_VERSION, cR as ROLE_STYLE_PROPERTY_DESCRIPTORS, cS as RadarBody, cT as RadarBodyAxis, cU as RadarBodyCurve, cX as RegionContainmentCertificate, cY as RenderCapabilityError, cZ as RenderOutputDescriptor, c_ as RenderOutputTransports, d1 as RenderedLayoutEdge, d2 as RenderedLayoutGroup, d3 as RenderedLayoutNode, d as RenderedRegion, d5 as ResolvedPngOutputPolicy, d6 as ResolvedTerminalOutputPolicy, d8 as RoleStyleFor, d9 as RoleStyleSpec, da as RoleStyles, db as RouteBlocker, dc as RouteCertificate, dd as RouteClass, de as RoutePortAssignment, df as SCENE_CONTRACT_VERSION, dg as SCENE_ROLE_DESCRIPTORS, dh as SCENE_VALIDATION_LIMITS, di as SCENE_VALIDATION_VERSION, dj as SEMANTIC_BINDING_CHANNELS, dk as SHARED_RENDER_OPTION_FIELDS, dl as STYLE_COLOR_TOKEN_DESCRIPTORS, dm as STYLE_SPEC_FIELD_DESCRIPTORS, dn as STYLE_SPEC_FORMAT_VERSION, dp as SceneDoc, dq as SceneNode, dr as SceneRole, ds as SceneValidationDiagnostic, dt as SceneValidationDiagnosticCode, du as SceneValidationError, dv as SceneValidationOptions, dw as SceneValidationResult, dx as SemanticBinding, dy as SemanticBindingChannel, dz as SemanticChannels, dA as SemanticSlots, dB as SequenceBody, dC as SequenceMessage, dD as SequenceMessageStyle, dF as SequenceParticipant, dH as SerializedFlowchartGraph, dI as SourceComment, dJ as SourceMap, dK as SourceMapSpans, dL as SourcePreservationReceipt, dM as SourceSpan, dN as SourceSpanPoint, dO as StateBody, dQ as StateNode, dR as StateTransition, dT as StyleBackend, dU as StyleBackendContext, dV as StyleColors, dW as StyleDescriptor, dX as StyleInput, dY as StyleReferenceResolution, dZ as StyleRegistrationOptions, d_ as StyleSpec, d$ as TERMINAL_BOUNDED_PADDING_X, e0 as TERMINAL_DEFAULT_BOX_BORDER_PADDING, e1 as TERMINAL_DEFAULT_PADDING_X, e2 as TERMINAL_DEFAULT_PADDING_Y, e3 as TERMINAL_OUTPUT_POLICY_VERSION, e4 as TEXT_MEASUREMENT_CONTRACT, e5 as TerminalOutputPolicyError, e6 as TerminalOutputPolicyInput, e7 as TextMeasurementContract, e8 as TextMeasurementInput, e9 as TextMeasurementResult, ea as Tier1WarningCode, eb as Tier2WarningCode, ec as TimelineBody, ed as TimelineEvent, ef as TimelinePeriod, eg as TimelineSection, ei as UNREGISTERED_FAMILY_CAPABILITY_STATES, ej as UPSTREAM_MERMAID_FAMILY_INDEX, ek as UpstreamFamilyDescriptor, el as UpstreamHeaderDescriptor, em as UpstreamHeaderMatch, en as UpstreamManifestDiff, eo as UpstreamMermaidFamilyIndex, ep as UpstreamMermaidManifest, er as ValidDiagramMeta, ev as WARNING_SEVERITY, ew as WARNING_TIER, ex as WarningCode, ey as WarningSeverity, ez as WarningTier, eA as XyChartAxis, eB as XyChartAxisSpec, eC as XyChartBody, eE as XyChartSeries, eG as asArchitecture, eH as asClass, eI as asEr, eJ as asFlowchart, eK as asGantt, eL as asGitGraph, eM as asJourney, eN as asMindmap, eO as asPie, eP as asQuadrant, eQ as asRadar, eR as asSequence, eS as asState, eT as asTimeline, eU as asXyChart, eV as assertHostedPngRasterBudget, eW as assertPngRasterBudget, eX as assertValidSceneDoc, eY as buildExternalScene, eZ as builtinFamilyMetadata, e_ as classifyMermaidFamilyFromFirstLine, e$ as createExtensionIdentity, f0 as declareFamilyScenePrimitiveEvidence, f1 as detectRegisteredFamilyFromFirstLine, f2 as effectiveFamilyCapabilityState, f3 as err, f4 as findUpstreamFamilyByHeader, f5 as getBackend, f6 as getFamily, f7 as getFamilyConformanceReport, f8 as getStyle, f9 as hostedFontResource, fa as inferBackend, fb as isBuiltinFamilyId, fc as isExternalFamilyId, fd as knownBackendDescriptors, fe as knownBuiltinFamilies, ff as knownFamilies, fg as knownStyleDescriptors, fh as knownStyles, fi as measureText, fj as measureTextWidth, fk as negotiateCapabilities, fl as negotiateRenderCapabilities, fm as normalizePortablePngBackground, fn as ok, fo as omitPngOutputOptions, fp as parseRegisteredMermaid, fq as parseSemVer, fr as pngNapiRuntimeProvenance, fs as pngOutputOptionsJsonSchema, ft as pngRasterDimensions, fu as prepareSvgForPngRasterization, fv as projectNativePngOutputPolicyInput, fw as projectPortablePngOutputOptions, fx as registerBackend, fy as registerStyle, fz as resolvePngOutputPolicy, fA as resolvePortablePngOutputPolicy, fB as resolveSceneRoleTraits, fC as resolveStyleReference, fD as resolveStyleStack, fE as resolveTerminalOutputPolicy, fF as runBackendConformance, fG as sceneRoleTraits, fH as semVerSatisfies, fI as sharedRenderOptionsJsonSchema, fJ as styleInputJsonSchema, fK as styleSpecJsonSchema, fL as svgIntrinsicDimensions, fM as terminalConnectorCapabilityClaims, fN as toFinite, fO as validatePrimitiveCapabilities, fP as validateResourceManifest, fQ as validateSceneDoc, fR as validateSerializableRenderOptions, fS as validateStyleSpec, fT as verifyNoExternalRefs, fU as verifyResourceBytes } from './index-D54dqSdC.js';
3
+
4
+ type MermaidFact = string;
5
+ interface CheckMermaidObjectSpec {
6
+ /** Required facts. Aliases: expected / require / required. */
7
+ include?: readonly string[];
8
+ expected?: readonly string[];
9
+ require?: readonly string[];
10
+ required?: readonly string[];
11
+ /** Forbidden facts. Aliases: absent / forbid / forbidden / unexpected. */
12
+ exclude?: readonly string[];
13
+ absent?: readonly string[];
14
+ forbid?: readonly string[];
15
+ forbidden?: readonly string[];
16
+ unexpected?: readonly string[];
17
+ /** When true, every emitted fact must be listed in the required set. */
18
+ exact?: boolean;
19
+ }
20
+ type CheckMermaidSpec = readonly string[] | CheckMermaidObjectSpec;
21
+ interface CheckMermaidResult {
22
+ ok: boolean;
23
+ /** Required facts not present in the diagram. */
24
+ missing: string[];
25
+ /** Forbidden facts that were present, or extra facts under exact:true. */
26
+ unexpected: string[];
27
+ /** Full deterministic fact set used for the comparison. */
28
+ facts: string[];
29
+ }
30
+ /** Facts for a parsed diagram. Output is sorted, de-duplicated, and single-line. */
31
+ declare function describeMermaidFacts(d: ParsedDiagram): string[];
32
+ /** Parse then emit facts. Parse failures are explicit Result errors. */
33
+ declare function describeMermaidFactsSource(source: string): Result<string[], ParseError[]>;
34
+ /** Check required/forbidden semantic facts against a parsed diagram. */
35
+ declare function checkMermaid(d: ParsedDiagram, spec: CheckMermaidSpec): CheckMermaidResult;
36
+ declare function checkMermaidSource(source: string, spec: CheckMermaidSpec): Result<CheckMermaidResult, ParseError[]>;
37
+
38
+ interface SerializeOptions {
39
+ /**
40
+ * Wrapper emission policy. 'verbatim' (default) re-emits the leading source
41
+ * wrapper (frontmatter, init directives, comments) byte-identically from
42
+ * `meta.wrapperSource`. 'canonical' synthesizes Mermaid's documented shape
43
+ * instead: one frontmatter block with `title`/`displayMode` at the top
44
+ * level and everything else nested under `config:`, init directives folded
45
+ * in (re-emitted raw only when their payload could not be folded), and
46
+ * wrapper comments dropped. Diagrams without a captured wrapper (e.g.
47
+ * synthesized from JSON payloads) always use canonical synthesis.
48
+ */
49
+ wrapper?: 'verbatim' | 'canonical';
50
+ }
51
+ declare function serializeMermaid(d: ParsedDiagram, opts?: SerializeOptions): string;
52
+ declare function synthesizeFromGraph(payload: ValidDiagramPayload & {
53
+ kind: ValidDiagram['kind'];
54
+ body: Exclude<ValidDiagramPayload['body'], ExtensionDiagramBody>;
55
+ }): Result<ValidDiagram, ParseError[]>;
56
+ declare function synthesizeFromGraph(payload: ValidDiagramPayload): Result<ParsedDiagram, ParseError[]>;
57
+
58
+ interface CreateMermaidOptions {
59
+ /** Layout direction for flowchart/state diagrams (default TD). Ignored elsewhere. */
60
+ direction?: Direction;
61
+ }
62
+ /** A mutation failure annotated with which op in the build list failed. */
63
+ type BuildError = MutationError & {
64
+ opIndex: number;
65
+ };
66
+ declare function createMermaid(kind: 'flowchart', opts?: CreateMermaidOptions): FlowchartValidDiagram;
67
+ declare function createMermaid(kind: 'state', opts?: CreateMermaidOptions): StateValidDiagram;
68
+ declare function createMermaid(kind: 'sequence', opts?: CreateMermaidOptions): SequenceValidDiagram;
69
+ declare function createMermaid(kind: 'timeline', opts?: CreateMermaidOptions): TimelineValidDiagram;
70
+ declare function createMermaid(kind: 'class', opts?: CreateMermaidOptions): ClassValidDiagram;
71
+ declare function createMermaid(kind: 'er', opts?: CreateMermaidOptions): ErValidDiagram;
72
+ declare function createMermaid(kind: 'journey', opts?: CreateMermaidOptions): JourneyValidDiagram;
73
+ declare function createMermaid(kind: 'architecture', opts?: CreateMermaidOptions): ArchitectureValidDiagram;
74
+ declare function createMermaid(kind: 'xychart', opts?: CreateMermaidOptions): XyChartValidDiagram;
75
+ declare function createMermaid(kind: 'pie', opts?: CreateMermaidOptions): PieValidDiagram;
76
+ declare function createMermaid(kind: 'quadrant', opts?: CreateMermaidOptions): QuadrantValidDiagram;
77
+ declare function createMermaid(kind: 'gantt', opts?: CreateMermaidOptions): GanttValidDiagram;
78
+ declare function createMermaid(kind: 'mindmap', opts?: CreateMermaidOptions): MindmapValidDiagram;
79
+ declare function createMermaid(kind: 'gitgraph', opts?: CreateMermaidOptions): GitGraphValidDiagram;
80
+ declare function createMermaid(kind: 'radar', opts?: CreateMermaidOptions): RadarValidDiagram;
81
+ declare function createMermaid(kind: DiagramKind, opts?: CreateMermaidOptions): MutableValidDiagram;
82
+ declare function buildMermaid(kind: 'flowchart', ops: FlowchartMutationOp[], opts?: CreateMermaidOptions): Result<FlowchartValidDiagram, BuildError>;
83
+ declare function buildMermaid(kind: 'state', ops: StateMutationOp[], opts?: CreateMermaidOptions): Result<StateValidDiagram, BuildError>;
84
+ declare function buildMermaid(kind: 'sequence', ops: SequenceMutationOp[], opts?: CreateMermaidOptions): Result<SequenceValidDiagram, BuildError>;
85
+ declare function buildMermaid(kind: 'timeline', ops: TimelineMutationOp[], opts?: CreateMermaidOptions): Result<TimelineValidDiagram, BuildError>;
86
+ declare function buildMermaid(kind: 'class', ops: ClassMutationOp[], opts?: CreateMermaidOptions): Result<ClassValidDiagram, BuildError>;
87
+ declare function buildMermaid(kind: 'er', ops: ErMutationOp[], opts?: CreateMermaidOptions): Result<ErValidDiagram, BuildError>;
88
+ declare function buildMermaid(kind: 'journey', ops: JourneyMutationOp[], opts?: CreateMermaidOptions): Result<JourneyValidDiagram, BuildError>;
89
+ declare function buildMermaid(kind: 'architecture', ops: ArchitectureMutationOp[], opts?: CreateMermaidOptions): Result<ArchitectureValidDiagram, BuildError>;
90
+ declare function buildMermaid(kind: 'xychart', ops: XyChartMutationOp[], opts?: CreateMermaidOptions): Result<XyChartValidDiagram, BuildError>;
91
+ declare function buildMermaid(kind: 'pie', ops: PieMutationOp[], opts?: CreateMermaidOptions): Result<PieValidDiagram, BuildError>;
92
+ declare function buildMermaid(kind: 'quadrant', ops: QuadrantMutationOp[], opts?: CreateMermaidOptions): Result<QuadrantValidDiagram, BuildError>;
93
+ declare function buildMermaid(kind: 'gantt', ops: GanttMutationOp[], opts?: CreateMermaidOptions): Result<GanttValidDiagram, BuildError>;
94
+ declare function buildMermaid(kind: 'mindmap', ops: MindmapMutationOp[], opts?: CreateMermaidOptions): Result<MindmapValidDiagram, BuildError>;
95
+ declare function buildMermaid(kind: 'gitgraph', ops: GitGraphMutationOp[], opts?: CreateMermaidOptions): Result<GitGraphValidDiagram, BuildError>;
96
+ declare function buildMermaid(kind: 'radar', ops: RadarMutationOp[], opts?: CreateMermaidOptions): Result<RadarValidDiagram, BuildError>;
97
+ declare function buildMermaid(kind: DiagramKind, ops: AnyMutationOp[], opts?: CreateMermaidOptions): Result<MutableValidDiagram, BuildError>;
98
+
99
+ declare function edgeIdOf(edge: MermaidEdge, idx?: number): string;
100
+
101
+ declare function mutate(d: FlowchartValidDiagram, op: FlowchartMutationOp): Result<FlowchartValidDiagram, MutationError>;
102
+ declare function mutate(d: StateValidDiagram, op: StateMutationOp): Result<StateValidDiagram, MutationError>;
103
+ declare function mutate(d: SequenceValidDiagram, op: SequenceMutationOp): Result<SequenceValidDiagram, MutationError>;
104
+ declare function mutate(d: TimelineValidDiagram, op: TimelineMutationOp): Result<TimelineValidDiagram, MutationError>;
105
+ declare function mutate(d: ClassValidDiagram, op: ClassMutationOp): Result<ClassValidDiagram, MutationError>;
106
+ declare function mutate(d: ErValidDiagram, op: ErMutationOp): Result<ErValidDiagram, MutationError>;
107
+ declare function mutate(d: JourneyValidDiagram, op: JourneyMutationOp): Result<JourneyValidDiagram, MutationError>;
108
+ declare function mutate(d: ArchitectureValidDiagram, op: ArchitectureMutationOp): Result<ArchitectureValidDiagram, MutationError>;
109
+ declare function mutate(d: XyChartValidDiagram, op: XyChartMutationOp): Result<XyChartValidDiagram, MutationError>;
110
+ declare function mutate(d: PieValidDiagram, op: PieMutationOp): Result<PieValidDiagram, MutationError>;
111
+ declare function mutate(d: QuadrantValidDiagram, op: QuadrantMutationOp): Result<QuadrantValidDiagram, MutationError>;
112
+ declare function mutate(d: GanttValidDiagram, op: GanttMutationOp): Result<GanttValidDiagram, MutationError>;
113
+ declare function mutate(d: RadarValidDiagram, op: RadarMutationOp): Result<RadarValidDiagram, MutationError>;
114
+ declare function mutate(d: MutableValidDiagram, op: AnyMutationOp): Result<MutableValidDiagram, MutationError>;
115
+ declare function mutate(d: ParsedDiagram, op: AnyMutationOp): Result<ParsedDiagram, MutationError>;
116
+ /**
117
+ * mutate with a shape check in front — the one choke point every UNTYPED edit
118
+ * path funnels through: the declarative applyOps/buildChecked entrypoints, the
119
+ * Code Mode facade, and the CLI `--op`/`--ops` path. Typed callers keep using
120
+ * `mutate` directly, where the compiler already guarantees op shape;
121
+ * `mutateChecked` restores that guarantee at the boundaries where ops arrive as
122
+ * raw JSON.
123
+ *
124
+ * `validateOp` proves the op's SHAPE (field names, primitive types, enums)
125
+ * BEFORE the mutator runs, so a malformed op is rejected with a prescriptive
126
+ * INVALID_OP error instead of silently mangling the diagram. Semantics — does
127
+ * the referenced node exist, is the id a duplicate — stay in the mutator, which
128
+ * runs second on a shape-proven op. Result shape is identical to `mutate`, so
129
+ * this is a drop-in wherever the raw mutator was called with untyped ops.
130
+ */
131
+ declare function mutateChecked(d: MutableValidDiagram, op: unknown): Result<MutableValidDiagram, MutationError>;
132
+ declare function mutateChecked(d: ParsedDiagram, op: unknown): Result<ParsedDiagram, MutationError>;
133
+
134
+ declare const MUTATION_OPS_BY_FAMILY: {
135
+ readonly flowchart: readonly ["add_node", "remove_node", "rename_node", "set_label", "add_edge", "remove_edge", "set_shape", "set_direction", "add_subgraph", "remove_subgraph", "move_node", "define_class", "set_node_class", "set_node_style"];
136
+ readonly state: readonly ["add_state", "remove_state", "rename_state", "set_state_label", "add_transition", "remove_transition", "set_transition_label", "make_composite", "set_direction", "move_state", "dissolve_composite", "add_note", "remove_note", "set_note_text", "define_class", "set_state_class", "set_state_style", "set_transition_style"];
137
+ readonly sequence: readonly ["add_participant", "remove_participant", "add_message", "remove_message", "set_message_text", "move_message", "set_participant_label", "add_fragment", "remove_fragment", "set_fragment_label", "add_fragment_branch", "set_fragment_branch_label", "add_fragment_message", "remove_fragment_message", "set_fragment_message_text"];
138
+ readonly timeline: readonly ["set_title", "add_section", "remove_section", "set_section_label", "add_period", "remove_period", "set_period_label", "add_event", "remove_event", "set_event_text", "move_period", "move_event", "move_section", "set_accessibility_title", "set_accessibility_description"];
139
+ readonly class: readonly ["set_title", "add_class", "remove_class", "rename_class", "set_class_generic", "add_member", "remove_member", "add_relation", "remove_relation", "add_note", "remove_note", "set_class_namespace", "define_class", "set_css_class", "set_class_style"];
140
+ readonly er: readonly ["add_entity", "remove_entity", "rename_entity", "set_entity_label", "add_attribute", "remove_attribute", "add_relation", "remove_relation", "set_direction", "define_class", "set_entity_class", "set_entity_style"];
141
+ readonly journey: readonly ["set_title", "add_section", "remove_section", "set_section_label", "add_task", "remove_task", "set_task_text", "set_task_score", "set_task_actors", "rename_actor", "move_task", "move_section", "set_accessibility_title", "set_accessibility_description"];
142
+ readonly architecture: readonly ["set_title", "set_accessibility_title", "set_accessibility_description", "add_service", "remove_service", "rename_service", "set_service_label", "set_service_icon", "move_service", "add_junction", "remove_junction", "rename_junction", "move_junction", "add_group", "set_group_label", "remove_group", "add_edge", "update_edge", "remove_edge"];
143
+ readonly xychart: readonly ["set_title", "set_x_axis", "set_y_axis", "add_series", "remove_series", "set_series_values", "set_series_name", "reorder_series", "set_orientation", "set_data_point"];
144
+ readonly pie: readonly ["set_title", "set_show_data", "add_slice", "remove_slice", "rename_slice", "set_slice_value", "reorder_slice"];
145
+ readonly quadrant: readonly ["set_title", "set_axis_labels", "set_quadrant_label", "add_point", "remove_point", "move_point", "rename_point"];
146
+ readonly gantt: readonly ["set_title", "add_section", "rename_section", "remove_section", "add_task", "remove_task", "rename_task", "set_task_status", "set_task_dates", "set_task_flags", "set_task_id", "move_task", "move_section"];
147
+ readonly mindmap: readonly ["add_node", "remove_node", "rename_node", "set_label", "move_node", "set_shape", "set_icon", "set_node_class", "set_accessibility_title", "set_accessibility_description"];
148
+ readonly gitgraph: readonly ["append_commit", "create_branch", "checkout_branch", "merge_branch", "cherry_pick", "set_commit_message", "set_commit_type", "set_commit_tags", "rename_branch", "set_accessibility_title", "set_accessibility_description"];
149
+ readonly radar: readonly ["set_title", "add_axis", "remove_axis", "rename_axis", "set_axis_label", "reorder_axis", "add_curve", "remove_curve", "set_curve_values", "set_curve_value", "set_curve_label", "rename_curve", "reorder_curve", "set_config"];
150
+ };
151
+ type MutableFamilyId = keyof typeof MUTATION_OPS_BY_FAMILY;
152
+
153
+ type OpFamily = MutableFamilyId;
154
+ /** True when `family` has a shape schema (i.e. is a mutable structured family).
155
+ * Own-property only: `family in SCHEMAS` would report inherited Object.prototype
156
+ * names (`toString`, `constructor`, `__proto__`, …) as families and mis-narrow them. */
157
+ declare function hasOpSchema(family: string): family is OpFamily;
158
+ /**
159
+ * Structured, model-actionable validation error. `code` is always INVALID_OP
160
+ * (so it flows through the existing MutationError channel unchanged), but the
161
+ * payload names the exact problem and enumerates the legal fields so a weak
162
+ * model can self-correct in one turn.
163
+ */
164
+ interface OpValidationError {
165
+ code: 'INVALID_OP';
166
+ /** 'expected_single_op' | 'unknown_kind' | 'unknown_field' | 'missing_field' | 'wrong_type' | 'require_one_of' */
167
+ reason: string;
168
+ message: string;
169
+ family: OpFamily;
170
+ opKind?: string;
171
+ /** the offending field, when applicable */
172
+ field?: string;
173
+ /** valid field names for this op (or valid op kinds, for unknown_kind) */
174
+ validFields?: string[];
175
+ /** nearest valid name to a typo'd field/kind, when an obvious match exists */
176
+ didYouMean?: string;
177
+ }
178
+ declare function validateOp(family: OpFamily, op: unknown): OpValidationError | null;
179
+ /** Machine-readable op menu for a family — { opKind: [fieldName, …] } — the
180
+ * basis for tool-discovery output. Optional fields are marked with a trailing
181
+ * `?`; the op's `kind` is implicit and omitted. */
182
+ declare function opMenu(family: OpFamily): Record<string, string[]>;
183
+ /** One field of an op, as a model needs it to fill the op correctly: the name,
184
+ * whether it is required, and a human type that spells out enum values inline
185
+ * (e.g. `one of "inheritance", "composition", …`). */
186
+ interface OpFieldDoc {
187
+ name: string;
188
+ required: boolean;
189
+ type: string;
190
+ note?: string;
191
+ }
192
+ /** Full field shapes for every op of a family — the thing a model must know to
193
+ * author a correct op without guessing (which the prescriptive INVALID_OP error
194
+ * only teaches AFTER a wrong guess). Surfaced in `am capabilities --json` and
195
+ * the declarative MCP tool descriptions so field names, required-ness, and enum
196
+ * vocabularies are discoverable up front. */
197
+ declare function describeOps(family: OpFamily): Record<string, OpFieldDoc[]>;
198
+ /** Compact one-line signatures for a family's ops — `add_relation(from, to,
199
+ * relKind, label?)` — for embedding in a tool description. Optional fields carry
200
+ * a trailing `?`; enum values are left to `describeOps`/the error to keep the
201
+ * menu short. */
202
+ declare function opSignatures(family: OpFamily): string[];
203
+
204
+ /** A verify summary reduced to plain JSON (no RenderedLayout proxy graph). */
205
+ interface VerifySummary {
206
+ ok: boolean;
207
+ warnings: VerifyResult['warnings'];
208
+ }
209
+ /** A mutation failure annotated with which op in the list failed. */
210
+ type CheckedBuildError = MutationError & {
211
+ opIndex: number;
212
+ };
213
+ /**
214
+ * THE single output DTO for the declarative surface. Success and failure share
215
+ * one shape: `ok` discriminates. Every field is plain JSON — safe to return
216
+ * straight out as an MCP tool result and safe to JSON round-trip: no
217
+ * `{ok,value}`-vs-plain split, no provenance proxy, no Map.
218
+ */
219
+ type OpEnvelope = {
220
+ ok: true;
221
+ family: DiagramKind;
222
+ /** canonical Mermaid source of the mutated diagram */
223
+ source: string;
224
+ verify: VerifySummary;
225
+ } | {
226
+ ok: false;
227
+ family: OpFamily | DiagramKind | null;
228
+ /** index of the failing op within the batch, when the failure is op-scoped */
229
+ opIndex?: number;
230
+ error: OpValidationError | {
231
+ code: string;
232
+ message: string;
233
+ details?: unknown;
234
+ };
235
+ };
236
+ /** Drop the layout proxy graph; keep the model-actionable verdict. The JSON
237
+ * round-trip guarantees no residual Map / prototype leaks through. */
238
+ declare function verifySummary(v: VerifyResult): VerifySummary;
239
+ /**
240
+ * buildMermaid's contract (createMermaid → fold ops) with the shape check in
241
+ * front of every op. Same Result shape as buildMermaid, so it is a drop-in for
242
+ * the untyped build path (Code Mode facade `buildMermaid`, declarative `build`).
243
+ */
244
+ declare function buildChecked(kind: DiagramKind, ops: unknown[], opts?: CreateMermaidOptions): Result<MutableValidDiagram, CheckedBuildError>;
245
+ interface ApplyOpsInput {
246
+ /** Existing Mermaid `source` to edit, OR `family` to author from blank. */
247
+ source?: string;
248
+ family?: string;
249
+ ops: unknown;
250
+ }
251
+ /**
252
+ * Plain-JSON-in / plain-JSON-out batch edit. Fail-fast, all-or-nothing: ops
253
+ * apply in order over a working copy; the first invalid or semantically-rejected
254
+ * op stops the batch and reports its index — nothing is committed (the input
255
+ * `source` is untouched, mirroring buildMermaid). Returns the canonical envelope.
256
+ */
257
+ declare function applyOps(input: ApplyOpsInput): OpEnvelope;
258
+
259
+ declare function verifyMermaid(input: ParsedDiagram | string, opts?: VerifyOptions): VerifyResult;
260
+
261
+ interface QualityMetrics {
262
+ edgeCrossings: number;
263
+ labelLegibility: number;
264
+ whitespaceBalance: number;
265
+ labelEdgeProximity: number;
266
+ minimumNodeSpacing: number;
267
+ elementDensity: number;
268
+ minimumTextContrast: number | null;
269
+ aspectRatio: number;
270
+ nodeCount: number;
271
+ edgeCount: number;
272
+ }
273
+ interface QualityBounds {
274
+ /** Max edge crossings per (edge × edge) pair. Default 0.05 = 5%. */
275
+ maxCrossingsRatio?: number;
276
+ /** Min label legibility. Default 0.85 = 85% of labels fit. */
277
+ minLabelLegibility?: number;
278
+ /** Whitespace fill band [min, max]. Default [0.05, 0.55]. */
279
+ whitespaceBand?: [number, number];
280
+ /** Min pixels between any edge-label bbox and a non-attached node, another edge-label, or another edge path. Default 4. */
281
+ minLabelEdgeProximity?: number;
282
+ /** Min pixels between distinct node/mark boxes. Default 8. */
283
+ minNodeSpacing?: number;
284
+ /** Elements (nodes + edges) per 10,000 canvas pixels. Default [0.02, 6]. */
285
+ elementDensityBand?: [number, number];
286
+ /** Minimum WCAG text contrast ratio. Default 4.5 (AA normal text). */
287
+ minTextContrast?: number;
288
+ /** Aspect ratio band [min, max]. Default [0.2, 5.0]. */
289
+ aspectBand?: [number, number];
290
+ }
291
+ declare const DEFAULT_BOUNDS: Required<QualityBounds>;
292
+ interface QualityMeasurementOptions {
293
+ /** Text/foreground paint. Defaults to the crisp theme foreground. */
294
+ foreground?: string;
295
+ /** Canvas paint. Defaults to the crisp theme background. */
296
+ background?: string;
297
+ /** Additional node/label fills to include in the minimum contrast. */
298
+ surfaces?: readonly string[];
299
+ /** Exact rendered text/surface pairs; these supersede foreground/surfaces while background remains the canvas paint. */
300
+ textPairs?: readonly {
301
+ foreground: string;
302
+ background: string;
303
+ }[];
304
+ }
305
+ type BoundBasis = 'evidence' | 'standard' | 'derived' | 'chosen' | 'sanity';
306
+ type ViolationSeverity = 'primary' | 'secondary' | 'sanity';
307
+ interface BoundProvenance {
308
+ basis: BoundBasis;
309
+ severity: ViolationSeverity;
310
+ note: string;
311
+ }
312
+ /** Per-metric provenance. Keyed by the QualityMetrics field each bound gates. */
313
+ declare const BOUND_PROVENANCE: Record<'edgeCrossings' | 'labelLegibility' | 'whitespaceBalance' | 'labelEdgeProximity' | 'minimumNodeSpacing' | 'elementDensity' | 'minimumTextContrast' | 'aspectRatio', BoundProvenance>;
314
+ declare function measureQuality(layout: RenderedLayout, options?: QualityMeasurementOptions): QualityMetrics;
315
+ interface RankedViolation {
316
+ metric: keyof typeof BOUND_PROVENANCE;
317
+ severity: ViolationSeverity;
318
+ message: string;
319
+ }
320
+ interface QualityVerdict {
321
+ ok: boolean;
322
+ metrics: QualityMetrics;
323
+ /**
324
+ * The same violations, each tagged with its evidence-based severity so a
325
+ * consumer can weight a crossings violation above a whitespace one
326
+ * (Purchase 1997/2002). Ordered primary → secondary → sanity.
327
+ */
328
+ ranked: RankedViolation[];
329
+ }
330
+ declare function checkQuality(layout: RenderedLayout, bounds?: QualityBounds, measurement?: QualityMeasurementOptions): QualityVerdict;
331
+
332
+ type LayoutCertificateProof = 'edge-route' | 'region-containment';
333
+ declare function layoutCertificateProof(cert: LayoutRouteCertificate): LayoutCertificateProof;
334
+
335
+ declare class FamilyConformanceError extends Error {
336
+ readonly report: FamilyConformanceReport;
337
+ constructor(report: FamilyConformanceReport);
338
+ }
339
+ /** Register a namespaced extension only after its canonical example proves
340
+ * every native declaration twice against the public execution contracts. */
341
+ declare function registerFamily(descriptor: FamilyDescriptor): () => void;
342
+
343
+ /**
344
+ * Invoke a descriptor's pure positioned view without parsing or laying out.
345
+ * This open-id form is useful to extension conformance tests even though the
346
+ * current public `RenderedLayout` envelope remains a closed built-in union.
347
+ */
348
+ declare function projectPositionedView(familyId: FamilyId, positioned: PositionedDiagram, options?: FamilyPositionedProjectionOptions): FamilyPositionedView | null;
349
+
350
+ type RegionKind = Exclude<RenderedRegionKind, 'canvas' | 'group'> | 'group' | 'subgraph';
351
+ type AsciiWarningCode = 'ASCII_RENDER_FAILED' | 'ASCII_EDGE_REGION_UNMAPPED' | TerminalProjectionDiagnosticCode;
352
+ interface AsciiWarning {
353
+ code: AsciiWarningCode;
354
+ message: string;
355
+ severity: 'degraded';
356
+ }
357
+ declare const ASCII_ROUTE_PARITY_CONTRACT: {
358
+ readonly version: 1;
359
+ readonly routeIntent: "shared-route-classes";
360
+ readonly svgSource: "route-contract classifyRoutes() + certificates";
361
+ readonly asciiSource: "grid router seeded with classifyRoutes() routeClass metadata, longest-path layering, and direct-lane-first routing";
362
+ readonly degradationWarnings: readonly ["ASCII_RENDER_FAILED", "ASCII_EDGE_REGION_UNMAPPED"];
363
+ };
364
+ interface AsciiRegion {
365
+ kind: RegionKind;
366
+ /** Stable identifier for the diagram element (e.g. node id, participant id). */
367
+ id: string;
368
+ /** Optional 1-based source line where the element was declared, when known. */
369
+ sourceLine?: number;
370
+ /** 0-based row in the rendered canvas where the region starts. */
371
+ canvasRow: number;
372
+ /** 0-based column where the region starts (inclusive). */
373
+ canvasColStart: number;
374
+ /** 0-based column where the region ends (exclusive). */
375
+ canvasColEnd: number;
376
+ /** Optional row count when the region spans multiple lines (boxed node). */
377
+ rowSpan?: number;
378
+ /** Normalized text this best-effort label region was matched from. */
379
+ projectedText?: string;
380
+ /** Exact rendered cells claimed by authored label glyphs. Route detectors use
381
+ * this position-specific mask instead of exempting a glyph everywhere. */
382
+ authoredTextCells?: Array<{
383
+ row: number;
384
+ column: number;
385
+ glyph: string;
386
+ }>;
387
+ }
388
+ interface AsciiWithMeta {
389
+ ascii: string;
390
+ regions: AsciiRegion[];
391
+ /** Inert action records keyed to the same stable target ids as `regions`. */
392
+ actions: DiagramActionRecord[];
393
+ warnings: AsciiWarning[];
394
+ routeParity: typeof ASCII_ROUTE_PARITY_CONTRACT;
395
+ }
396
+ declare function renderMermaidASCIIWithMeta(input: ParsedDiagram | string, opts?: AsciiRenderOptions): AsciiWithMeta;
397
+
398
+ interface DescribeOptions {
399
+ /** 'text' (default): prose summary. 'json': structured AX tree (#7349). 'facts': deterministic semantic facts. */
400
+ format?: 'text' | 'json' | 'facts';
401
+ }
402
+ /** Structured accessibility tree (#7349): the graph as a list of nodes + edges. */
403
+ interface DescribeTree {
404
+ kind: string;
405
+ nodes: Array<{
406
+ id: string;
407
+ label: string;
408
+ }>;
409
+ edges: Array<{
410
+ from: string;
411
+ to: string;
412
+ label?: string;
413
+ sequence?: {
414
+ fragmentIndex: number;
415
+ branchIndex: number;
416
+ fragmentKind: string;
417
+ branchLabel?: string;
418
+ };
419
+ }>;
420
+ entryPoints: string[];
421
+ sinks: string[];
422
+ }
423
+ declare function describeMermaidSource(source: string, opts?: DescribeOptions): string;
424
+ declare function describeMermaid(d: ParsedDiagram, opts?: DescribeOptions): string;
425
+ /**
426
+ * #7349: machine-readable accessibility tree — the graph as a flat node/edge
427
+ * list with entry points and sinks. More useful to agents and screen-reader
428
+ * tooling than prose. Covers the structured families; source-level/opaque
429
+ * families expose extracted labels as nodes and no edges.
430
+ */
431
+ declare function describeMermaidTree(d: ParsedDiagram): DescribeTree;
432
+
433
+ declare function analyzeMermaid(d: ParsedDiagram): DiagramAnalysis;
434
+ declare function analyzeMermaidSource(source: string): Result<DiagramAnalysis, ParseError[]>;
435
+ declare function collectActionRecords(d: ParsedDiagram): DiagramActionRecord[];
436
+
437
+ /**
438
+ * Reverse an ASCII flowchart render back to (best-effort) Mermaid source.
439
+ * Returns synthesized ids (N0, N1, …) with recovered labels and edges.
440
+ */
441
+ declare function asciiToMermaid(ascii: string, opts?: {
442
+ direction?: 'TD' | 'LR';
443
+ }): Result<string, ParseError[]>;
444
+
445
+ declare function renderMermaidSVG(input: ParsedDiagram | string, opts?: Parameters<typeof renderMermaidSVG$1>[1]): string;
446
+ declare function renderMermaidSVGWithReceipt(input: ParsedDiagram | string, opts?: Parameters<typeof renderMermaidSVG$1>[1]): RenderedSvg;
447
+ declare function renderMermaidASCII(input: ParsedDiagram | string, opts?: Parameters<typeof renderMermaidASCII$1>[1]): string;
448
+ declare function renderMermaidASCIIWithReceipt(input: ParsedDiagram | string, opts?: Parameters<typeof renderMermaidASCII$1>[1]): RenderedAscii;
449
+ interface LayoutMermaidOptions extends RenderOptions {
450
+ debug?: boolean;
451
+ regions?: boolean;
452
+ actions?: boolean;
453
+ }
454
+ type LayoutRenderOptions = LayoutMermaidOptions;
455
+ interface RenderedLayoutArtifact {
456
+ layout: RenderedLayout;
457
+ receipt: RenderRequestReceipt;
458
+ }
459
+ /** Canonical layout transport for Code Mode and other receipt-aware adapters. */
460
+ declare function layoutMermaidWithReceipt(input: ParsedDiagram | string, opts?: LayoutRenderOptions): RenderedLayoutArtifact;
461
+ declare function layoutMermaid(d: ParsedDiagram, opts?: LayoutMermaidOptions): RenderedLayout;
462
+
463
+ export { ASCII_ROUTE_PARITY_CONTRACT, AnyMutationOp, type ApplyOpsInput, ArchitectureMutationOp, ArchitectureValidDiagram, type AsciiRegion, AsciiRenderOptions, type AsciiWarning, type AsciiWarningCode, type AsciiWithMeta, BOUND_PROVENANCE, type BoundBasis, type BoundProvenance, type BuildError, type CheckMermaidObjectSpec, type CheckMermaidResult, type CheckMermaidSpec, type CheckedBuildError, ClassMutationOp, ClassValidDiagram, type CreateMermaidOptions, DEFAULT_BOUNDS, type DescribeOptions, type DescribeTree, DiagramActionRecord, DiagramAnalysis, DiagramKind, ErMutationOp, ErValidDiagram, ExtensionDiagramBody, FamilyConformanceError, FamilyConformanceReport, FamilyDescriptor, FamilyId, FamilyPositionedProjectionOptions, FamilyPositionedView, FlowchartMutationOp, FlowchartValidDiagram, GanttMutationOp, GanttValidDiagram, GitGraphMutationOp, GitGraphValidDiagram, JourneyMutationOp, JourneyValidDiagram, type LayoutCertificateProof, type LayoutMermaidOptions, type LayoutRenderOptions, LayoutRouteCertificate, type MermaidFact, MindmapMutationOp, MindmapValidDiagram, MutableValidDiagram, MutationError, type OpEnvelope, type OpFamily, type OpFieldDoc, type OpValidationError, ParseError, ParsedDiagram, PieMutationOp, PieValidDiagram, QuadrantMutationOp, QuadrantValidDiagram, type QualityBounds, type QualityMeasurementOptions, type QualityMetrics, type QualityVerdict, RadarMutationOp, RadarValidDiagram, type RankedViolation, type RegionKind, RenderRequestReceipt, RenderedAscii, RenderedLayout, type RenderedLayoutArtifact, RenderedRegionKind, Result, SequenceMutationOp, SequenceValidDiagram, StateMutationOp, StateValidDiagram, TimelineMutationOp, TimelineValidDiagram, ValidDiagram, ValidDiagramPayload, VerifyOptions, VerifyResult, type VerifySummary, type ViolationSeverity, XyChartMutationOp, XyChartValidDiagram, analyzeMermaid, analyzeMermaidSource, applyOps, asciiToMermaid, buildChecked, buildMermaid, checkMermaid, checkMermaidSource, checkQuality, collectActionRecords, createMermaid, describeMermaid, describeMermaidFacts, describeMermaidFactsSource, describeMermaidSource, describeMermaidTree, describeOps, edgeIdOf, hasOpSchema, layoutCertificateProof, layoutMermaid, layoutMermaidWithReceipt, measureQuality, mutate, mutateChecked, opMenu, opSignatures, projectPositionedView, registerFamily, renderMermaidASCII, renderMermaidASCIIWithMeta, renderMermaidASCIIWithReceipt, renderMermaidSVG, renderMermaidSVGWithReceipt, serializeMermaid, synthesizeFromGraph, validateOp, verifyMermaid, verifySummary };