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
package/dist/agent.d.ts CHANGED
@@ -1,1828 +1,23 @@
1
- import { N as NodeShape, E as EdgeStyle, M as MermaidFrontmatterMap, a as MermaidConfigMap, b as MermaidGraph, D as Direction, R as RouteClass, c as EdgeRouteCertificate, d as RegionContainmentCertificate, e as MermaidNode, f as MermaidEdge, g as NormalizedMermaidSource, h as RenderOptions, i as DiagramColors, P as PositionedDiagram, j as RenderContext, S as SceneDoc, A as AsciiConfig, C as ColorMode, k as AsciiTheme, L as LayoutRouteCertificate, l as AsciiRenderOptions, r as renderMermaidASCII$1, m as renderMermaidSVG$1, n as StyleInput } from './index-x2Cj1dVv.js';
2
- export { o as AnyPort, p as DiamondFacet, F as FamilyEdgeRouteCertificate, q as FamilyRouteCertificate, s as LayoutRouteClass, t as PortSemanticRole, u as PortSide, v as RouteBlocker, w as RouteCertificate, x as RoutePortAssignment, y as StyleSpec, T as TEXT_MEASUREMENT_CONTRACT, z as TextMeasurementContract, B as TextMeasurementInput, G as TextMeasurementResult, H as getStyle, I as inferBackend, J as knownStyles, K as measureText, O as measureTextWidth, Q as registerStyle, U as resolveStyleStack, V as validateStyleSpec, W as verifyNoExternalRefs } from './index-x2Cj1dVv.js';
3
-
4
- type Result<T, E> = {
5
- ok: true;
6
- value: T;
7
- } | {
8
- ok: false;
9
- error: E;
10
- };
11
- declare function ok<T, E = never>(value: T): Result<T, E>;
12
- declare function err<E, T = never>(error: E): Result<T, E>;
13
- type DiagramKind = 'flowchart' | 'state' | 'sequence' | 'class' | 'er' | 'timeline' | 'journey' | 'xychart' | 'architecture' | 'pie' | 'quadrant' | 'gantt';
14
- interface SequenceParticipant {
15
- id: string;
16
- label: string;
17
- kind: 'participant' | 'actor';
18
- }
19
- type SequenceMessageStyle = 'sync' | 'reply' | 'async' | 'async-dashed' | 'lost' | 'lost-dashed';
20
- interface SequenceMessage {
21
- from: string;
22
- to: string;
23
- text: string;
24
- style: SequenceMessageStyle;
25
- }
26
- type SequenceStatement = {
27
- kind: 'participant';
28
- ref: number;
29
- } | {
30
- kind: 'message';
31
- ref: number;
32
- } | {
33
- kind: 'opaque-block';
34
- lines: string[];
35
- };
36
- interface SequenceBody {
37
- kind: 'sequence';
38
- participants: SequenceParticipant[];
39
- messages: SequenceMessage[];
40
- statements?: SequenceStatement[];
41
- }
42
- interface TimelineEvent {
43
- /** Stable within one parse; recomputed each parse. Not a durable identifier. */
44
- id: string;
45
- text: string;
46
- }
47
- interface TimelinePeriod {
48
- id: string;
49
- /** The temporal label (e.g., "2020", "Q1 2024"). */
50
- label: string;
51
- events: TimelineEvent[];
52
- }
53
- interface TimelineSection {
54
- id: string;
55
- /** Undefined = implicit/ungrouped section. */
56
- label?: string;
57
- periods: TimelinePeriod[];
58
- }
59
- interface TimelineBody {
60
- kind: 'timeline';
61
- title?: string;
62
- sections: TimelineSection[];
63
- }
64
- interface JourneyTask {
65
- /** Stable within one parse; recomputed each parse. Not a durable identifier. */
66
- id: string;
67
- text: string;
68
- /** Satisfaction score, integer 1..5 (Mermaid journey convention). */
69
- score: number;
70
- actors: string[];
71
- }
72
- interface JourneySection {
73
- id: string;
74
- /** Undefined = implicit/ungrouped section. */
75
- label?: string;
76
- tasks: JourneyTask[];
77
- }
78
- interface JourneyBody {
79
- kind: 'journey';
80
- title?: string;
81
- /** Optional accessibility title from Mermaid accTitle. */
82
- accessibilityTitle?: string;
83
- /** Optional accessibility description from Mermaid accDescr. */
84
- accessibilityDescription?: string;
85
- sections: JourneySection[];
86
- }
87
- type ClassRelationKind = 'inheritance' | 'composition' | 'aggregation' | 'association' | 'dependency' | 'realization' | 'link-solid' | 'link-dashed';
88
- interface ClassNode {
89
- /** The bare class name (e.g., 'Animal'). */
90
- id: string;
91
- /** Optional display label (e.g., from `class X["My Label"]` or `class X as "..."`). */
92
- label?: string;
93
- /** Members, each as the raw source string ('+String name', '+eat()', '<<interface>>'). */
94
- members: string[];
95
- }
96
- interface ClassRelation {
97
- from: string;
98
- to: string;
99
- kind: ClassRelationKind;
100
- /** Optional relationship label, e.g., from `A --> B : uses`. */
101
- label?: string;
102
- /** Optional cardinality on the `from` side (e.g., '"1"'). */
103
- fromCardinality?: string;
104
- /** Optional cardinality on the `to` side. */
105
- toCardinality?: string;
106
- }
107
- interface ClassNote {
108
- text: string;
109
- /** Class id the note is attached to (undefined = freestanding). */
110
- for?: string;
111
- }
112
- interface ClassBody {
113
- kind: 'class';
114
- title?: string;
115
- classes: ClassNode[];
116
- relations: ClassRelation[];
117
- notes: ClassNote[];
118
- }
119
- type ErCardinality = 'one-only' | 'zero-or-one' | 'zero-or-many' | 'one-or-many';
120
- interface ErAttribute {
121
- /** The full source line (e.g., 'string name PK "comment"'). */
122
- text: string;
123
- }
124
- interface ErEntity {
125
- id: string;
126
- attributes: ErAttribute[];
127
- }
128
- interface ErRelation {
129
- from: string;
130
- to: string;
131
- leftCard: ErCardinality;
132
- rightCard: ErCardinality;
133
- /** Solid (--) or dashed (..) line. */
134
- dashed: boolean;
135
- label?: string;
136
- }
137
- interface ErBody {
138
- kind: 'er';
139
- entities: ErEntity[];
140
- relations: ErRelation[];
141
- }
142
- type ArchitectureSide = 'L' | 'R' | 'T' | 'B';
143
- interface ArchitectureGroup {
144
- id: string;
145
- label: string;
146
- icon?: string;
147
- /** Undefined = root (not nested in another group). */
148
- parentId?: string;
149
- }
150
- interface ArchitectureService {
151
- id: string;
152
- label: string;
153
- icon?: string;
154
- /** Undefined = ungrouped (not inside a group). */
155
- parentId?: string;
156
- }
157
- interface ArchitectureJunction {
158
- id: string;
159
- parentId?: string;
160
- }
161
- interface ArchitectureEndpoint {
162
- id: string;
163
- side: ArchitectureSide;
164
- }
165
- interface ArchitectureEdge {
166
- source: ArchitectureEndpoint;
167
- target: ArchitectureEndpoint;
168
- label?: string;
169
- hasArrowStart: boolean;
170
- hasArrowEnd: boolean;
171
- }
172
- interface ArchitectureBody {
173
- kind: 'architecture';
174
- groups: ArchitectureGroup[];
175
- services: ArchitectureService[];
176
- junctions: ArchitectureJunction[];
177
- edges: ArchitectureEdge[];
178
- }
179
- /** A single chart axis: an optional bare-text name plus EITHER categorical
180
- * labels (x-axis only) OR a numeric range. All three fields are optional;
181
- * a structured axis carries at least one of them. */
182
- interface XyChartAxis {
183
- /** Optional bare-text axis name/title. */
184
- name?: string;
185
- /** Categorical labels (x-axis only) — mutually exclusive with range. */
186
- categories?: string[];
187
- /** Numeric range — mutually exclusive with categories. */
188
- range?: {
189
- min: number;
190
- max: number;
191
- };
192
- }
193
- interface XyChartSeries {
194
- /** Stable within one parse; recomputed each parse. Not a durable identifier. */
195
- id: string;
196
- kind: 'bar' | 'line';
197
- /** Optional bare-text series name. */
198
- name?: string;
199
- /** Data values; all finite. */
200
- values: number[];
201
- }
202
- interface XyChartBody {
203
- kind: 'xychart';
204
- title?: string;
205
- /** Header orientation suffix: `xychart-beta horizontal`. Default vertical. */
206
- horizontal?: boolean;
207
- xAxis?: XyChartAxis;
208
- yAxis?: XyChartAxis;
209
- series: XyChartSeries[];
210
- }
211
- interface PieSlice {
212
- /** Stable within one parse; recomputed each parse. Not a durable identifier. */
213
- id: string;
214
- /** The slice label (contents of the `"..."` quotes). */
215
- label: string;
216
- /** The slice value — a positive finite number. */
217
- value: number;
218
- }
219
- interface PieBody {
220
- kind: 'pie';
221
- title?: string;
222
- /** When true (`pie showData`), the legend shows each slice's numeric value. */
223
- showData: boolean;
224
- /** Slices in source order (drawn clockwise). */
225
- slices: PieSlice[];
226
- }
227
- /** Axis label pair. The "far" side is optional in the grammar. */
228
- interface QuadrantAxis {
229
- /** x-axis: left label / y-axis: bottom label. */
230
- near: string;
231
- /** x-axis: right label / y-axis: top label. Optional. */
232
- far?: string;
233
- }
234
- interface QuadrantPoint {
235
- label: string;
236
- /** Normalized x in [0, 1] (0 = left, 1 = right). */
237
- x: number;
238
- /** Normalized y in [0, 1] (0 = bottom, 1 = top). */
239
- y: number;
240
- }
241
- interface QuadrantBody {
242
- kind: 'quadrant';
243
- title?: string;
244
- xAxis?: QuadrantAxis;
245
- yAxis?: QuadrantAxis;
246
- /**
247
- * Quadrant region labels indexed 1..4 by Mermaid's numbering:
248
- * 1 = top-right, 2 = top-left, 3 = bottom-left, 4 = bottom-right.
249
- * Stored 0-based where index `n-1` holds quadrant-`n`.
250
- */
251
- quadrants: [string?, string?, string?, string?];
252
- /** Plotted points in source order. */
253
- points: QuadrantPoint[];
254
- }
255
- type GanttBodyTaskTag = 'active' | 'done' | 'crit' | 'milestone' | 'vert';
256
- interface GanttBodyTask {
257
- /** Stable within one parse; recomputed each parse. Not a durable identifier. */
258
- id: string;
259
- /** Mermaid task id from `:id, start, end` — referenced by after/until/click. */
260
- taskId?: string;
261
- label: string;
262
- /** Status/shape tags in canonical order (active/done/crit/milestone/vert). */
263
- tags: GanttBodyTaskTag[];
264
- /** Raw start expression: a date in the diagram's dateFormat or `after id…`.
265
- * Undefined = starts when the previous task ends (Mermaid default). */
266
- start?: string;
267
- /** Raw end expression: a date, a duration token (`3d`), or `until id…`. */
268
- end: string;
269
- }
270
- interface GanttBodySection {
271
- id: string;
272
- /** Undefined = implicit/ungrouped section. */
273
- label?: string;
274
- tasks: GanttBodyTask[];
275
- }
276
- /**
277
- * Segment-preserving statement list (the sequence-body pattern): typed ops see
278
- * sections/tasks/title; calendar directives (dateFormat, excludes, weekend…),
279
- * click lines, comments, and markers ride along VERBATIM as opaque-block
280
- * segments — never dropped, edited at the source level only.
281
- */
282
- type GanttStatement = {
283
- kind: 'title';
284
- } | {
285
- kind: 'section';
286
- ref: number;
287
- } | {
288
- kind: 'task';
289
- section: number;
290
- ref: number;
291
- } | {
292
- kind: 'opaque-block';
293
- lines: string[];
294
- };
295
- interface GanttBody {
296
- kind: 'gantt';
297
- title?: string;
298
- sections: GanttBodySection[];
299
- /** Optional for synthesized payloads; parsed bodies always populate it. */
300
- statements?: GanttStatement[];
301
- }
302
- /**
303
- * A state node. Simple states carry an optional display label; composite states
304
- * additionally carry their own nested `states` + `transitions` (and an optional
305
- * per-composite `direction`). The reserved pseudostate `[*]` is NOT a StateNode
306
- * — it is modeled contextually as the endpoint id '[*]' on transitions (source
307
- * = start pseudostate, target = end pseudostate), scoped per composite level.
308
- */
309
- interface StateNode {
310
- id: string;
311
- /** Optional display label (`state "Label" as id` / `id : Label`). */
312
- label?: string;
313
- /** Composite children — present iff this is a composite state. */
314
- states?: StateNode[];
315
- /** Composite-internal transitions — present iff this is a composite state. */
316
- transitions?: StateTransition[];
317
- /** Optional per-composite layout direction. */
318
- direction?: Direction;
319
- }
320
- interface StateTransition {
321
- /** Source state id, or '[*]' for a start pseudostate. */
322
- from: string;
323
- /** Target state id, or '[*]' for an end pseudostate. */
324
- to: string;
325
- label?: string;
326
- }
327
- interface StateBody {
328
- kind: 'state';
329
- states: StateNode[];
330
- transitions: StateTransition[];
331
- /** Optional top-level layout direction. */
332
- direction?: Direction;
333
- }
334
- interface SourceComment {
335
- text: string;
336
- line: number;
337
- }
338
- interface InitDirective {
339
- raw: string;
340
- parsed: MermaidConfigMap;
341
- }
342
- interface Accessibility {
343
- title?: string;
344
- descr?: string;
345
- }
346
- interface ValidDiagramMeta {
347
- frontmatter?: MermaidFrontmatterMap;
348
- initDirectives: InitDirective[];
349
- comments: SourceComment[];
350
- accessibility: Accessibility;
351
- /**
352
- * The leading source wrapper (frontmatter block, `%%{init}%%` directives,
353
- * `%%` comments, and blank lines before the diagram header), preserved
354
- * byte-verbatim. serializeMermaid re-emits it untouched by default;
355
- * canonical wrapper synthesis is opt-in via `{ wrapper: 'canonical' }`.
356
- * Absent on diagrams synthesized from JSON payloads, which fall back to
357
- * canonical synthesis.
358
- */
359
- wrapperSource?: string;
360
- /**
361
- * In-body `%%` comments that structured serialization does not preserve,
362
- * computed at parse time by diffing against the canonical serialization.
363
- * Surfaced by verify as the Tier 3 `COMMENT_DROPPED` lint. Opaque bodies
364
- * preserve comments verbatim and never set this.
365
- */
366
- droppedComments?: SourceComment[];
367
- }
368
- interface SourceLocation {
369
- line: number;
370
- col: number;
371
- }
372
- interface SourceMap {
373
- nodes: Map<string, SourceLocation>;
374
- edges: Map<string, SourceLocation>;
375
- groups: Map<string, SourceLocation>;
376
- /** Stable label spans where known: `node:<id>`, `edge#<i>:<from>-><to>`, `group:<id>`. */
377
- labels: Map<string, SourceLocation>;
378
- }
379
- type DiagramActionKind = 'href' | 'call' | 'callback';
380
- type DiagramActionSecurity = 'safe' | 'unsafe' | 'source-only' | 'unsupported';
381
- interface DiagramActionRecord {
382
- /** Stable source-side action id (`action:<family>:<target>:<n>`). */
383
- id?: string;
384
- /** Region id this action attaches to when a rendered layout exposes regions. */
385
- regionId?: string;
386
- family: DiagramKind;
387
- target: string;
388
- action: DiagramActionKind;
389
- /** Original action payload after the target id; never executed by analysis. */
390
- raw: string;
391
- line?: number;
392
- href?: string;
393
- security: DiagramActionSecurity;
394
- executable: false;
395
- message?: string;
396
- }
397
- interface FeedbackEdgeAnalysis {
398
- edgeIndex: number;
399
- from: NodeId;
400
- to: NodeId;
401
- label?: string;
402
- routeClass: RouteClass;
403
- }
404
- interface GanttScheduleAnalysisSummary {
405
- criticalPathTaskIds: string[];
406
- slackByTaskId: Record<string, number>;
407
- projectStart: number;
408
- projectEnd: number;
409
- entryTaskIds: string[];
410
- sinkTaskIds: string[];
411
- }
412
- interface DiagramAnalysis {
413
- kind: DiagramKind;
414
- feedbackEdges: FeedbackEdgeAnalysis[];
415
- actions: DiagramActionRecord[];
416
- gantt?: GanttScheduleAnalysisSummary;
417
- }
418
- type DiagramBody = {
419
- kind: 'flowchart';
420
- graph: MermaidGraph;
421
- } | StateBody | SequenceBody | TimelineBody | ClassBody | ErBody | JourneyBody | ArchitectureBody | XyChartBody | PieBody | QuadrantBody | GanttBody
422
- /**
423
- * Opaque body — the parser understood the family header but encountered
424
- * unmodeled syntax. `source` is the ORIGINAL body with indentation, blank
425
- * lines, and comments PRESERVED (per the Loop 5 Phase A fix), so the
426
- * serializer can re-emit byte-for-byte. Distinct from `ValidDiagram.canonicalSource`,
427
- * which for structured bodies is the rebuilt canonical form.
428
- */
429
- | {
430
- kind: 'opaque';
431
- family: DiagramKind;
432
- source: string;
433
- };
434
- interface ValidDiagram {
435
- readonly kind: DiagramKind;
436
- readonly meta: ValidDiagramMeta;
437
- readonly body: DiagramBody;
438
- readonly source: SourceMap;
439
- /**
440
- * Load-bearing round-trip pillar. See AGENT_NATIVE.md § (3).
441
- *
442
- * For STRUCTURED bodies, `canonicalSource` is the normalized text
443
- * (`normalized.text` from `mermaid-source.ts`) — used by `renderMermaidSVG`
444
- * + the legacy parser for the flowchart pathway. After `serializeMermaid`,
445
- * the re-emitted source is rebuilt from the structured body.
446
- *
447
- * For OPAQUE bodies, the serializer emits `body.source` directly (NOT
448
- * `canonicalSource`) so original indentation and blank lines round-trip
449
- * byte-for-byte. `canonicalSource` is still set, but it's the normalized
450
- * (line-trimmed) form — useful for layout / rendering, not for fidelity.
451
- *
452
- * This split exists because the legacy flowchart parser needs trimmed
453
- * lines, but opaque-fallback round-trip needs the original. Treat
454
- * `body.source` as the source of truth for opaque-body fidelity.
455
- */
456
- readonly canonicalSource: string;
457
- }
458
- type FlowchartValidDiagram = ValidDiagram & {
459
- body: {
460
- kind: 'flowchart';
461
- graph: MermaidGraph;
462
- };
463
- };
464
- type StateValidDiagram = ValidDiagram & {
465
- body: StateBody;
466
- };
467
- type SequenceValidDiagram = ValidDiagram & {
468
- body: SequenceBody;
469
- };
470
- type TimelineValidDiagram = ValidDiagram & {
471
- body: TimelineBody;
472
- };
473
- type ClassValidDiagram = ValidDiagram & {
474
- body: ClassBody;
475
- };
476
- type ErValidDiagram = ValidDiagram & {
477
- body: ErBody;
478
- };
479
- type JourneyValidDiagram = ValidDiagram & {
480
- body: JourneyBody;
481
- };
482
- type ArchitectureValidDiagram = ValidDiagram & {
483
- body: ArchitectureBody;
484
- };
485
- type XyChartValidDiagram = ValidDiagram & {
486
- body: XyChartBody;
487
- };
488
- type PieValidDiagram = ValidDiagram & {
489
- body: PieBody;
490
- };
491
- type QuadrantValidDiagram = ValidDiagram & {
492
- body: QuadrantBody;
493
- };
494
- type GanttValidDiagram = ValidDiagram & {
495
- body: GanttBody;
496
- };
497
- type MutableValidDiagram = FlowchartValidDiagram | StateValidDiagram | SequenceValidDiagram | TimelineValidDiagram | ClassValidDiagram | ErValidDiagram | JourneyValidDiagram | ArchitectureValidDiagram | XyChartValidDiagram | PieValidDiagram | QuadrantValidDiagram | GanttValidDiagram;
498
- declare function asFlowchart(d: ValidDiagram): FlowchartValidDiagram | null;
499
- declare function asState(d: ValidDiagram): StateValidDiagram | null;
500
- declare function asSequence(d: ValidDiagram): SequenceValidDiagram | null;
501
- declare function asTimeline(d: ValidDiagram): TimelineValidDiagram | null;
502
- declare function asClass(d: ValidDiagram): ClassValidDiagram | null;
503
- declare function asEr(d: ValidDiagram): ErValidDiagram | null;
504
- declare function asJourney(d: ValidDiagram): JourneyValidDiagram | null;
505
- declare function asArchitecture(d: ValidDiagram): ArchitectureValidDiagram | null;
506
- declare function asXyChart(d: ValidDiagram): XyChartValidDiagram | null;
507
- declare function asPie(d: ValidDiagram): PieValidDiagram | null;
508
- declare function asQuadrant(d: ValidDiagram): QuadrantValidDiagram | null;
509
- declare function asGantt(d: ValidDiagram): GanttValidDiagram | null;
510
- interface ParseError {
511
- code: string;
512
- message: string;
513
- line?: number;
514
- col?: number;
515
- }
516
- interface MutationError {
517
- code: 'NODE_NOT_FOUND' | 'EDGE_NOT_FOUND' | 'PARTICIPANT_NOT_FOUND' | 'MESSAGE_NOT_FOUND' | 'SECTION_NOT_FOUND' | 'PERIOD_NOT_FOUND' | 'EVENT_NOT_FOUND' | 'TASK_NOT_FOUND' | 'ACTOR_NOT_FOUND' | 'CLASS_NOT_FOUND' | 'MEMBER_NOT_FOUND' | 'RELATION_NOT_FOUND' | 'NOTE_NOT_FOUND' | 'ENTITY_NOT_FOUND' | 'ATTRIBUTE_NOT_FOUND' | 'SERVICE_NOT_FOUND' | 'GROUP_NOT_FOUND' | 'SERIES_NOT_FOUND' | 'SLICE_NOT_FOUND' | 'POINT_NOT_FOUND' | 'STATE_NOT_FOUND' | 'TRANSITION_NOT_FOUND' | 'DUPLICATE_NODE' | 'DUPLICATE_PARTICIPANT' | 'DUPLICATE_CLASS' | 'DUPLICATE_ENTITY' | 'DUPLICATE_STATE' | 'DUPLICATE_TASK' | 'INVALID_OP';
518
- message: string;
519
- }
520
- type NodeId = string;
521
- type EdgeId = string;
522
- type GroupId = string;
523
- type ParticipantId = string;
524
- type FlowchartMutationOp = {
525
- kind: 'add_node';
526
- id: NodeId;
527
- label: string;
528
- shape?: NodeShape;
529
- parent?: GroupId;
530
- } | {
531
- kind: 'remove_node';
532
- id: NodeId;
533
- } | {
534
- kind: 'rename_node';
535
- from: NodeId;
536
- to: NodeId;
537
- } | {
538
- kind: 'set_label';
539
- target: NodeId | EdgeId;
540
- label: string;
541
- } | {
542
- kind: 'add_edge';
543
- from: NodeId;
544
- to: NodeId;
545
- label?: string;
546
- style?: EdgeStyle;
547
- } | {
548
- kind: 'remove_edge';
549
- id: EdgeId;
550
- };
551
- type SequenceMutationOp = {
552
- kind: 'add_participant';
553
- id: ParticipantId;
554
- label?: string;
555
- participantKind?: 'participant' | 'actor';
556
- } | {
557
- kind: 'remove_participant';
558
- id: ParticipantId;
559
- } | {
560
- kind: 'add_message';
561
- from: ParticipantId;
562
- to: ParticipantId;
563
- text: string;
564
- style?: SequenceMessageStyle;
565
- } | {
566
- kind: 'remove_message';
567
- index: number;
568
- } | {
569
- kind: 'set_message_text';
570
- index: number;
571
- text: string;
572
- };
573
- type TimelineMutationOp = {
574
- kind: 'set_title';
575
- title: string | null;
576
- } | {
577
- kind: 'add_section';
578
- label: string;
579
- } | {
580
- kind: 'remove_section';
581
- index: number;
582
- } | {
583
- kind: 'set_section_label';
584
- index: number;
585
- label: string;
586
- } | {
587
- kind: 'add_period';
588
- sectionIndex: number;
589
- label: string;
590
- events?: string[];
591
- } | {
592
- kind: 'remove_period';
593
- sectionIndex: number;
594
- periodIndex: number;
595
- } | {
596
- kind: 'set_period_label';
597
- sectionIndex: number;
598
- periodIndex: number;
599
- label: string;
600
- } | {
601
- kind: 'add_event';
602
- sectionIndex: number;
603
- periodIndex: number;
604
- text: string;
605
- } | {
606
- kind: 'remove_event';
607
- sectionIndex: number;
608
- periodIndex: number;
609
- eventIndex: number;
610
- } | {
611
- kind: 'set_event_text';
612
- sectionIndex: number;
613
- periodIndex: number;
614
- eventIndex: number;
615
- text: string;
616
- };
617
- type ClassMutationOp = {
618
- kind: 'set_title';
619
- title: string | null;
620
- } | {
621
- kind: 'add_class';
622
- id: string;
623
- label?: string;
624
- members?: string[];
625
- } | {
626
- kind: 'remove_class';
627
- id: string;
628
- } | {
629
- kind: 'rename_class';
630
- from: string;
631
- to: string;
632
- } | {
633
- kind: 'add_member';
634
- class: string;
635
- text: string;
636
- } | {
637
- kind: 'remove_member';
638
- class: string;
639
- index: number;
640
- } | {
641
- kind: 'add_relation';
642
- from: string;
643
- to: string;
644
- relKind: ClassRelationKind;
645
- label?: string;
646
- } | {
647
- kind: 'remove_relation';
648
- index: number;
649
- } | {
650
- kind: 'add_note';
651
- text: string;
652
- for?: string;
653
- } | {
654
- kind: 'remove_note';
655
- index: number;
656
- };
657
- type ErMutationOp = {
658
- kind: 'add_entity';
659
- id: string;
660
- attributes?: string[];
661
- } | {
662
- kind: 'remove_entity';
663
- id: string;
664
- } | {
665
- kind: 'rename_entity';
666
- from: string;
667
- to: string;
668
- } | {
669
- kind: 'add_attribute';
670
- entity: string;
671
- text: string;
672
- } | {
673
- kind: 'remove_attribute';
674
- entity: string;
675
- index: number;
676
- } | {
677
- kind: 'add_relation';
678
- from: string;
679
- to: string;
680
- leftCard: ErCardinality;
681
- rightCard: ErCardinality;
682
- dashed?: boolean;
683
- label?: string;
684
- } | {
685
- kind: 'remove_relation';
686
- index: number;
687
- };
688
- type JourneyMutationOp = {
689
- kind: 'set_title';
690
- title: string | null;
691
- } | {
692
- kind: 'add_section';
693
- label: string;
694
- } | {
695
- kind: 'remove_section';
696
- index: number;
697
- } | {
698
- kind: 'set_section_label';
699
- index: number;
700
- label: string;
701
- } | {
702
- kind: 'add_task';
703
- sectionIndex: number;
704
- text: string;
705
- score: number;
706
- actors?: string[];
707
- } | {
708
- kind: 'remove_task';
709
- sectionIndex: number;
710
- taskIndex: number;
711
- } | {
712
- kind: 'set_task_text';
713
- sectionIndex: number;
714
- taskIndex: number;
715
- text: string;
716
- } | {
717
- kind: 'set_task_score';
718
- sectionIndex: number;
719
- taskIndex: number;
720
- score: number;
721
- } | {
722
- kind: 'set_task_actors';
723
- sectionIndex: number;
724
- taskIndex: number;
725
- actors: string[];
726
- } | {
727
- kind: 'rename_actor';
728
- from: string;
729
- to: string;
730
- };
731
- type ArchitectureMutationOp = {
732
- kind: 'add_service';
733
- id: string;
734
- label?: string;
735
- icon?: string | null;
736
- group?: string | null;
737
- } | {
738
- kind: 'remove_service';
739
- id: string;
740
- } | {
741
- kind: 'rename_service';
742
- from: string;
743
- to: string;
744
- } | {
745
- kind: 'set_service_label';
746
- id: string;
747
- label: string;
748
- } | {
749
- kind: 'set_service_icon';
750
- id: string;
751
- icon: string | null;
752
- } | {
753
- kind: 'move_service';
754
- id: string;
755
- group: string | null;
756
- } | {
757
- kind: 'add_group';
758
- id: string;
759
- label?: string;
760
- icon?: string | null;
761
- parent?: string | null;
762
- } | {
763
- kind: 'remove_group';
764
- id: string;
765
- } | {
766
- kind: 'add_edge';
767
- from: string;
768
- to: string;
769
- fromSide: ArchitectureSide;
770
- toSide: ArchitectureSide;
771
- label?: string | null;
772
- hasArrowStart?: boolean;
773
- hasArrowEnd?: boolean;
774
- } | {
775
- kind: 'remove_edge';
776
- index?: number;
777
- id?: string;
778
- };
779
- type StateMutationOp = {
780
- kind: 'add_state';
781
- id: string;
782
- label?: string | null;
783
- parent?: string | null;
784
- } | {
785
- kind: 'remove_state';
786
- id: string;
787
- } | {
788
- kind: 'rename_state';
789
- from: string;
790
- to: string;
791
- } | {
792
- kind: 'set_state_label';
793
- id: string;
794
- label: string | null;
795
- } | {
796
- kind: 'add_transition';
797
- from: string;
798
- to: string;
799
- label?: string | null;
800
- parent?: string | null;
801
- } | {
802
- kind: 'remove_transition';
803
- index?: number;
804
- from?: string;
805
- to?: string;
806
- parent?: string | null;
807
- } | {
808
- kind: 'set_transition_label';
809
- index?: number;
810
- from?: string;
811
- to?: string;
812
- label: string | null;
813
- parent?: string | null;
814
- } | {
815
- kind: 'make_composite';
816
- id: string;
817
- members: string[];
818
- label?: string | null;
819
- };
820
- type XyChartAxisSpec = {
821
- name?: string | null;
822
- categories?: string[];
823
- range?: {
824
- min: number;
825
- max: number;
826
- };
827
- };
828
- type XyChartMutationOp = {
829
- kind: 'set_title';
830
- title: string | null;
831
- } | {
832
- kind: 'set_x_axis';
833
- axis: XyChartAxisSpec | null;
834
- } | {
835
- kind: 'set_y_axis';
836
- axis: XyChartAxisSpec | null;
837
- } | {
838
- kind: 'add_series';
839
- kind2: 'bar' | 'line';
840
- name?: string | null;
841
- values: number[];
842
- } | {
843
- kind: 'remove_series';
844
- index: number;
845
- } | {
846
- kind: 'set_series_values';
847
- index: number;
848
- values: number[];
849
- } | {
850
- kind: 'set_series_name';
851
- index: number;
852
- name: string | null;
853
- } | {
854
- kind: 'reorder_series';
855
- from: number;
856
- to: number;
857
- };
858
- type PieMutationOp = {
859
- kind: 'set_title';
860
- title: string | null;
861
- } | {
862
- kind: 'set_show_data';
863
- showData: boolean;
864
- } | {
865
- kind: 'add_slice';
866
- label: string;
867
- value: number;
868
- } | {
869
- kind: 'remove_slice';
870
- label: string;
871
- } | {
872
- kind: 'rename_slice';
873
- from: string;
874
- to: string;
875
- } | {
876
- kind: 'set_slice_value';
877
- label: string;
878
- value: number;
879
- } | {
880
- kind: 'reorder_slice';
881
- from: number;
882
- to: number;
883
- };
884
- type QuadrantMutationOp = {
885
- kind: 'set_title';
886
- title: string | null;
887
- } | {
888
- kind: 'set_axis_labels';
889
- axis: 'x' | 'y';
890
- near: string | null;
891
- far?: string | null;
892
- } | {
893
- kind: 'set_quadrant_label';
894
- quadrant: number;
895
- label: string | null;
896
- } | {
897
- kind: 'add_point';
898
- label: string;
899
- x: number;
900
- y: number;
901
- } | {
902
- kind: 'remove_point';
903
- label: string;
904
- } | {
905
- kind: 'move_point';
906
- label: string;
907
- x: number;
908
- y: number;
909
- } | {
910
- kind: 'rename_point';
911
- from: string;
912
- to: string;
913
- };
914
- type GanttMutationOp = {
915
- kind: 'set_title';
916
- title: string | null;
917
- } | {
918
- kind: 'add_section';
919
- label: string;
920
- } | {
921
- kind: 'rename_section';
922
- index: number;
923
- label: string;
924
- } | {
925
- kind: 'remove_section';
926
- index: number;
927
- } | {
928
- kind: 'add_task';
929
- sectionIndex: number;
930
- label: string;
931
- taskId?: string;
932
- tags?: GanttBodyTaskTag[];
933
- start?: string;
934
- end: string;
935
- } | {
936
- kind: 'remove_task';
937
- sectionIndex: number;
938
- taskIndex: number;
939
- } | {
940
- kind: 'rename_task';
941
- sectionIndex: number;
942
- taskIndex: number;
943
- label: string;
944
- } | {
945
- kind: 'set_task_status';
946
- sectionIndex: number;
947
- taskIndex: number;
948
- status: 'active' | 'done' | 'crit' | null;
949
- } | {
950
- kind: 'set_task_dates';
951
- sectionIndex: number;
952
- taskIndex: number;
953
- start?: string | null;
954
- end?: string;
955
- };
956
- type AnyMutationOp = FlowchartMutationOp | StateMutationOp | SequenceMutationOp | TimelineMutationOp | ClassMutationOp | ErMutationOp | JourneyMutationOp | ArchitectureMutationOp | XyChartMutationOp | PieMutationOp | QuadrantMutationOp | GanttMutationOp;
957
- type MutationOp = FlowchartMutationOp;
958
- declare const FINITE_BRAND: unique symbol;
959
- type Finite = number & {
960
- readonly [FINITE_BRAND]: true;
961
- };
962
- declare function toFinite(n: number): Finite;
963
- type WarningSeverity = 'error' | 'warning';
964
- type WarningTier = 'structural' | 'geometric' | 'lint';
965
- type Tier1WarningCode = 'EMPTY_DIAGRAM' | 'EDGE_MISANCHORED' | 'OFF_CANVAS' | 'GROUP_BREACH' | 'UNKNOWN_SHAPE' | 'LABEL_OVERFLOW' | 'UNRESOLVABLE_SCHEDULE' | 'RENDER_FAILED';
966
- type Tier2WarningCode = 'NODE_OVERLAP' | 'ROUTE_SELF_CROSS' | 'ROUTE_HITCH' | 'ROUTE_UNEXPLAINED_BEND' | 'ROUTE_LABEL_ON_SHARED_TRUNK' | 'ROUTE_CONTAINER_MISANCHOR' | 'ROUTE_SHAPE_MISANCHOR' | 'ROUTE_STALE_AFTER_NODE_MOVE';
967
- /**
968
- * Tier 3 (advisory lint). Family-specific quality hints for common agent
969
- * mistakes that still parse and render. Lint warnings never flip verify.ok.
970
- */
971
- type Tier3WarningCode = 'DUPLICATE_EDGE' | 'UNREACHABLE_NODE' | 'DECISION_BRANCH_UNLABELED' | 'COMMENT_DROPPED' | 'UNSUPPORTED_SYNTAX' | 'CONTENT_DROPPED_ON_ROUNDTRIP';
972
- type WarningCode = Tier1WarningCode | Tier2WarningCode | Tier3WarningCode;
973
- type LayoutWarning = {
974
- code: 'EMPTY_DIAGRAM';
975
- } | {
976
- code: 'EDGE_MISANCHORED';
977
- edge: EdgeId;
978
- from?: NodeId;
979
- to?: NodeId;
980
- } | {
981
- code: 'OFF_CANVAS';
982
- target: NodeId | EdgeId;
983
- axis: 'x' | 'y';
984
- } | {
985
- code: 'GROUP_BREACH';
986
- group: GroupId;
987
- member: NodeId;
988
- } | {
989
- code: 'UNKNOWN_SHAPE';
990
- node: NodeId;
991
- shape: string;
992
- } | {
993
- code: 'LABEL_OVERFLOW';
994
- target: NodeId | EdgeId;
995
- charCount: number;
996
- limit: number;
997
- }
998
- /**
999
- * The diagram parses (and round-trips) but its semantics cannot resolve, so
1000
- * rendering will fail loudly — e.g. a Gantt whose schedule hits a bad
1001
- * calendar date, a dependency cycle, or an everything-excluded calendar.
1002
- * `reason` carries the named renderer error (GANTT_*…). Closes the
1003
- * "verify ok but render throws" seam for structured gantt bodies.
1004
- */
1005
- | {
1006
- code: 'UNRESOLVABLE_SCHEDULE';
1007
- reason: string;
1008
- }
1009
- /**
1010
- * The diagram parses on the agent side (possibly with unmodeled syntax
1011
- * preserved verbatim) but the STRICT render parser throws on its canonical
1012
- * source — `am render` would exit 4. Generalizes UNRESOLVABLE_SCHEDULE's
1013
- * "verify ok but render throws" seam-closing to every family: found live
1014
- * when onboarding agents followed verify-before-commit and still shipped
1015
- * unrenderable quadrant/architecture diagrams. `reason` carries the
1016
- * renderer's error message.
1017
- */
1018
- | {
1019
- code: 'RENDER_FAILED';
1020
- reason: string;
1021
- } | {
1022
- code: 'NODE_OVERLAP';
1023
- a: NodeId;
1024
- b: NodeId;
1025
- areaPx: number;
1026
- } | {
1027
- code: 'ROUTE_SELF_CROSS';
1028
- edge: EdgeId;
1029
- count: number;
1030
- } | {
1031
- code: 'ROUTE_HITCH';
1032
- edge: EdgeId;
1033
- deviationPx: number;
1034
- } | {
1035
- code: 'ROUTE_UNEXPLAINED_BEND';
1036
- edge: EdgeId;
1037
- } | {
1038
- code: 'ROUTE_LABEL_ON_SHARED_TRUNK';
1039
- edge: EdgeId;
1040
- sharedWith: EdgeId;
1041
- } | {
1042
- code: 'ROUTE_CONTAINER_MISANCHOR';
1043
- edge: EdgeId;
1044
- container: GroupId;
1045
- } | {
1046
- code: 'ROUTE_SHAPE_MISANCHOR';
1047
- edge: EdgeId;
1048
- node: NodeId;
1049
- } | {
1050
- code: 'ROUTE_STALE_AFTER_NODE_MOVE';
1051
- edge: EdgeId;
1052
- node: NodeId;
1053
- } | {
1054
- code: 'DUPLICATE_EDGE';
1055
- edge: EdgeId;
1056
- duplicateOf: EdgeId;
1057
- from: NodeId;
1058
- to: NodeId;
1059
- label?: string;
1060
- } | {
1061
- code: 'UNREACHABLE_NODE';
1062
- node: NodeId;
1063
- } | {
1064
- code: 'DECISION_BRANCH_UNLABELED';
1065
- node: NodeId;
1066
- edge: EdgeId;
1067
- } | {
1068
- code: 'COMMENT_DROPPED';
1069
- count: number;
1070
- lines: number[];
1071
- } | {
1072
- code: 'UNSUPPORTED_SYNTAX';
1073
- line?: number;
1074
- syntax: string;
1
+ import { AsciiWarning } from './agent-core.js';
2
+ export { ASCII_ROUTE_PARITY_CONTRACT, ApplyOpsInput, AsciiRegion, AsciiWarningCode, AsciiWithMeta, BOUND_PROVENANCE, BoundBasis, BoundProvenance, BuildError, CheckMermaidObjectSpec, CheckMermaidResult, CheckMermaidSpec, CheckedBuildError, CreateMermaidOptions, DEFAULT_BOUNDS, DescribeOptions, DescribeTree, FamilyConformanceError, LayoutCertificateProof, LayoutMermaidOptions, LayoutRenderOptions, MermaidFact, OpEnvelope, OpFamily, OpFieldDoc, OpValidationError, QualityBounds, QualityMeasurementOptions, QualityMetrics, QualityVerdict, RankedViolation, RegionKind, RenderedLayoutArtifact, VerifySummary, ViolationSeverity, 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 } from './agent-core.js';
3
+ import { P as ParsedDiagram, R as RenderOptions, a as PngOutputPolicyInput, b as RenderRequestReceipt, c as PngRuntimeProvenance, H as HostBackendPolicy, A as AsciiRenderOptions, d as RenderedRegion, D as DiagramActionRecord } from './index-D54dqSdC.js';
4
+ export { e as Accessibility, f as AnyMutationOp, g as AnyPort, h as ArchitectureBody, i as ArchitectureEdge, j as ArchitectureEndpoint, k as ArchitectureEndpointBoundary, l as ArchitectureGroup, m as ArchitectureJunction, n as ArchitectureMutationOp, o as ArchitectureService, p as ArchitectureSide, q as ArchitectureValidDiagram, 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, a7 as ClassMutationOp, a8 as ClassNode, a9 as ClassNote, aa as ClassRelation, ab as ClassRelationKind, ac as ClassValidDiagram, 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, ay as DiagramAnalysis, az as DiagramBody, aA as DiagramKind, 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, aL as ErMutationOp, aM as ErRelation, aN as ErValidDiagram, aO as ExactStyleSceneRole, aP as ExtensionDiagramBody, 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, bd as FamilyConformanceReport, be as FamilyConformanceStatus, bf as FamilyDescriptor, bg as FamilyDetectionDiagnostic, bh as FamilyEdgeRouteCertificate, bi as FamilyId, bj as FamilyOperations, bk as FamilyParsedBody, bl as FamilyPositionedProjectionContext, bm as FamilyPositionedProjectionOptions, bn as FamilyPositionedView, bo as FamilyRouteCertificate, bp as FamilyScenePositivePrimitive, bq as FamilyScenePrimitiveApplicability, br as FamilyScenePrimitiveEvidence, bs as FamilySceneRolePrimitiveDeclaration, bt as FeedbackEdgeAnalysis, bu as Finite, bv as FlowchartMutationOp, bw as FlowchartValidDiagram, bx as GanttBody, by as GanttBodySection, bz as GanttBodyTask, bA as GanttBodyTaskTag, bB as GanttMutationOp, bC as GanttScheduleAnalysisSummary, bD as GanttStatement, bE as GanttValidDiagram, bF as GitGraphBody, bG as GitGraphMutationOp, bH as GitGraphValidDiagram, bI as GroupId, bJ as HOSTED_FONT_RESOURCES, bK as InitDirective, bL as JourneyBody, bM as JourneyMutationOp, bN as JourneySection, bO as JourneyTask, bP as JourneyValidDiagram, bQ as LayoutRouteCertificate, 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, c2 as MindmapMutationOp, c3 as MindmapValidDiagram, c4 as MutableValidDiagram, c5 as MutationError, 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, cl as ParseError, cm as ParticipantId, cn as PieBody, co as PieMutationOp, cp as PieSlice, cq as PieValidDiagram, cr as PngFitTo, cs as PngFontSource, ct as PngOutputOptionField, cu as PngOutputOptionFieldDescriptor, cv as PngOutputOptionInputKind, cw as PngOutputOptionPolicyState, cx as PngOutputOptionReceiptState, cy as PngOutputOptionScope, cz as PngRasterDimensions, 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, cJ as QuadrantMutationOp, cK as QuadrantPoint, cL as QuadrantValidDiagram, 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, cV as RadarMutationOp, cW as RadarValidDiagram, cX as RegionContainmentCertificate, cY as RenderCapabilityError, cZ as RenderOutputDescriptor, c_ as RenderOutputTransports, c$ as RenderedAscii, d0 as RenderedLayout, d1 as RenderedLayoutEdge, d2 as RenderedLayoutGroup, d3 as RenderedLayoutNode, d4 as RenderedRegionKind, d5 as ResolvedPngOutputPolicy, d6 as ResolvedTerminalOutputPolicy, d7 as Result, 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, dE as SequenceMutationOp, dF as SequenceParticipant, dG as SequenceValidDiagram, dH as SerializedFlowchartGraph, dI as SourceComment, dJ as SourceMap, dK as SourceMapSpans, dL as SourcePreservationReceipt, dM as SourceSpan, dN as SourceSpanPoint, dO as StateBody, dP as StateMutationOp, dQ as StateNode, dR as StateTransition, dS as StateValidDiagram, 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, ee as TimelineMutationOp, ef as TimelinePeriod, eg as TimelineSection, eh as TimelineValidDiagram, 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, eq as ValidDiagram, er as ValidDiagramMeta, es as ValidDiagramPayload, et as VerifyOptions, eu as VerifyResult, 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, eD as XyChartMutationOp, eE as XyChartSeries, eF as XyChartValidDiagram, 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';
5
+
6
+ interface PngFontWarning {
7
+ code: 'PNG_FONT_COVERAGE';
8
+ script: string;
9
+ chars: string[];
1075
10
  message: string;
1076
11
  }
1077
- /**
1078
- * Structured content was lost across a parse → serialize → re-parse cycle:
1079
- * the {nodes, edges, groups} tally changed, so canonical serialization is
1080
- * silently dropping (or duplicating) a node/edge/group even though the bytes
1081
- * may re-parse. The faithfulness analogue of COMMENT_DROPPED — "100% parse
1082
- * success is not faithfulness" (Loop 17). Lint, never flips verify.ok.
1083
- */
1084
- | {
1085
- code: 'CONTENT_DROPPED_ON_ROUNDTRIP';
1086
- before: {
1087
- nodes: number;
1088
- edges: number;
1089
- groups: number;
1090
- };
1091
- after: {
1092
- nodes: number;
1093
- edges: number;
1094
- groups: number;
1095
- };
1096
- };
1097
- declare const WARNING_SEVERITY: Record<WarningCode, WarningSeverity>;
1098
- declare const WARNING_TIER: Record<WarningCode, WarningTier>;
1099
- declare const DEFAULT_LABEL_CHAR_CAP = 40;
1100
- interface VerifyOptions {
1101
- suppress?: WarningCode[];
1102
- labelCharCap?: number;
1103
- }
1104
- type RenderedRegionKind = 'node' | 'edge' | 'label' | 'group' | 'canvas';
1105
- interface RenderedRegion {
1106
- id: string;
1107
- kind: RenderedRegionKind;
1108
- elementId?: string;
1109
- parentId?: string;
1110
- bounds: {
1111
- x: Finite;
1112
- y: Finite;
1113
- w: Finite;
1114
- h: Finite;
1115
- };
1116
- sourceLine?: number;
1117
- }
1118
- interface RenderedLayoutNode {
1119
- id: NodeId;
1120
- x: Finite;
1121
- y: Finite;
1122
- w: Finite;
1123
- h: Finite;
1124
- shape: string;
1125
- label?: string;
1126
- }
1127
- interface RenderedLayoutEdge {
1128
- id: EdgeId;
1129
- from: NodeId;
1130
- to: NodeId;
1131
- path: [Finite, Finite][];
1132
- label?: {
1133
- x: Finite;
1134
- y: Finite;
1135
- text: string;
1136
- };
1137
- /** Edge route certificate; present only under layoutMermaid(d, { debug: true }) for families with an edge certificate model. */
1138
- route?: EdgeRouteCertificate;
1139
- }
1140
- interface RenderedLayoutGroup {
1141
- id: GroupId;
1142
- x: Finite;
1143
- y: Finite;
1144
- w: Finite;
1145
- h: Finite;
1146
- members: NodeId[];
1147
- label?: string;
1148
- /** Parent group id for flattened region-tree consumers; undefined means root-level group. */
1149
- parentId?: GroupId;
1150
- }
1151
- interface RenderedLayout {
1152
- version: 1;
1153
- kind: DiagramKind;
1154
- nodes: RenderedLayoutNode[];
1155
- edges: RenderedLayoutEdge[];
1156
- groups: RenderedLayoutGroup[];
1157
- /** Region-containment certificates for non-edge invariants; present only under layoutMermaid(d, { debug: true }). */
1158
- certificates?: RegionContainmentCertificate[];
1159
- /** Optional region sidecar for renderer/action alignment; debug-only in layoutMermaid V1. */
1160
- regions?: RenderedRegion[];
1161
- /** Optional source-only actions aligned to region ids; debug-only in layoutMermaid V1. */
1162
- actions?: DiagramActionRecord[];
1163
- bounds: {
1164
- w: Finite;
1165
- h: Finite;
1166
- };
1167
- }
1168
- interface VerifyResult {
1169
- ok: boolean;
1170
- warnings: LayoutWarning[];
1171
- layout: RenderedLayout;
1172
- }
1173
- interface SerializedFlowchartGraph {
1174
- direction: Direction;
1175
- nodes: Record<string, MermaidNode> | Array<[string, MermaidNode]>;
1176
- edges?: MermaidEdge[];
1177
- subgraphs?: unknown;
1178
- classDefs?: unknown;
1179
- classAssignments?: unknown;
1180
- nodeStyles?: unknown;
1181
- linkStyles?: unknown;
1182
- }
1183
- interface ValidDiagramPayload {
1184
- kind: DiagramKind;
1185
- meta?: Partial<ValidDiagramMeta>;
1186
- body: {
1187
- kind: 'flowchart';
1188
- graph: SerializedFlowchartGraph;
1189
- } | StateBody | SequenceBody | TimelineBody | ClassBody | ErBody | JourneyBody | ArchitectureBody | XyChartBody | PieBody | QuadrantBody | GanttBody | {
1190
- kind: 'opaque';
1191
- family: DiagramKind;
1192
- source: string;
1193
- };
1194
- }
1195
-
1196
- type MermaidFact = string;
1197
- interface CheckMermaidObjectSpec {
1198
- /** Required facts. Aliases: expected / require / required. */
1199
- include?: readonly string[];
1200
- expected?: readonly string[];
1201
- require?: readonly string[];
1202
- required?: readonly string[];
1203
- /** Forbidden facts. Aliases: absent / forbid / forbidden / unexpected. */
1204
- exclude?: readonly string[];
1205
- absent?: readonly string[];
1206
- forbid?: readonly string[];
1207
- forbidden?: readonly string[];
1208
- unexpected?: readonly string[];
1209
- /** When true, every emitted fact must be listed in the required set. */
1210
- exact?: boolean;
1211
- }
1212
- type CheckMermaidSpec = readonly string[] | CheckMermaidObjectSpec;
1213
- interface CheckMermaidResult {
1214
- ok: boolean;
1215
- /** Required facts not present in the diagram. */
1216
- missing: string[];
1217
- /** Forbidden facts that were present, or extra facts under exact:true. */
1218
- unexpected: string[];
1219
- /** Full deterministic fact set used for the comparison. */
1220
- facts: string[];
1221
- }
1222
- /** Facts for a parsed diagram. Output is sorted, de-duplicated, and single-line. */
1223
- declare function describeMermaidFacts(d: ValidDiagram): string[];
1224
- /** Parse then emit facts. Parse failures are explicit Result errors. */
1225
- declare function describeMermaidFactsSource(source: string): Result<string[], ParseError[]>;
1226
- /** Check required/forbidden semantic facts against a parsed diagram. */
1227
- declare function checkMermaid(d: ValidDiagram, spec: CheckMermaidSpec): CheckMermaidResult;
1228
- declare function checkMermaidSource(source: string, spec: CheckMermaidSpec): Result<CheckMermaidResult, ParseError[]>;
1229
12
 
1230
- interface ExtractedLabel {
1231
- /** The label text, with quotes stripped. */
1232
- text: string;
1233
- /** Best-effort target identifier (node id, participant, period, etc.). */
1234
- target: string;
1235
- }
1236
- interface FamilyLayoutContext {
1237
- source: NormalizedMermaidSource;
1238
- options: RenderOptions;
1239
- /** Render options after public-entrypoint normalization, e.g. security/font/config threading. */
1240
- renderOptions: RenderOptions;
1241
- colors: DiagramColors;
1242
- }
1243
- interface FamilyLayoutResult<TPositioned extends PositionedDiagram = PositionedDiagram> {
1244
- positioned: TPositioned;
1245
- /** Optional family-specific palette override for rendering/finalization. */
1246
- colors?: DiagramColors;
1247
- /** Optional family-specific render options override for RenderContext. */
1248
- options?: RenderOptions;
1249
- /** False when the family renderer already owns SVG accessibility metadata. */
1250
- injectAccessibility?: boolean;
1251
- }
1252
- interface AsciiContext {
1253
- source: NormalizedMermaidSource;
1254
- config: AsciiConfig;
1255
- colorMode: ColorMode;
1256
- theme: AsciiTheme;
1257
- options: {
1258
- maxWidth?: number;
1259
- ganttToday?: string;
1260
- };
13
+ interface PngOptions extends RenderOptions, PngOutputPolicyInput {
14
+ /** Receives glyph-coverage warnings instead of the default stderr write.
15
+ * Warnings never change the PNG bytes; identical inputs render
16
+ * identically whether or not a handler is installed. */
17
+ onWarning?: (warning: PngFontWarning) => void;
1261
18
  }
1262
- interface FamilyPlugin {
1263
- /** The DiagramKind this plugin owns. */
1264
- id: DiagramKind;
1265
- /** First-non-blank-line predicate. Lowercase, leading whitespace stripped. */
1266
- detect: (firstLineLower: string) => boolean;
1267
- /**
1268
- * Source-based label extractor for universal Tier 1 LABEL_OVERFLOW on opaque
1269
- * bodies. Each plugin should extract everything an agent would consider a
1270
- * label — node text, edge text, message text, axis names, section titles.
1271
- * The generic fallback (extractLabelsGeneric) is used when a family doesn't
1272
- * provide its own.
1273
- */
1274
- extractLabels?: (source: string) => ExtractedLabel[];
1275
- /**
1276
- * Family-specific structured parser. `lines` are the normalized source
1277
- * lines including the header; `opaqueSource` is the original body for
1278
- * lossless fallback; `canonicalSource` is the full normalized text (the
1279
- * legacy flowchart parser consumes it whole). Structured-or-opaque
1280
- * families return ok(structured ?? opaque); error-semantics families
1281
- * (flowchart/state) return err(ParseError[]).
1282
- */
1283
- parse?: (lines: string[], opaqueSource: string, meta: ValidDiagramMeta, canonicalSource: string) => Result<DiagramBody, ParseError[]>;
1284
- /**
1285
- * Optional source-map builder, run after a successful parse. Today only
1286
- * flowchart/state index node positions; other families return no map.
1287
- */
1288
- buildSourceMap?: (body: DiagramBody, canonicalSource: string) => SourceMap;
1289
- /** Optional: family-specific serializer for a structured body. */
1290
- serialize?: (body: DiagramBody) => string;
1291
- /** Optional: family-specific structured mutation. */
1292
- mutate?: (body: DiagramBody, op: AnyMutationOp) => Result<DiagramBody, MutationError>;
1293
- /** Optional: family-specific verify (Tier 1 + Tier 2). Returns warnings only. */
1294
- verify?: (body: DiagramBody, opts: VerifyOptions) => LayoutWarning[];
1295
- /** Optional: family-specific source-to-positioned layout for public SVG rendering. */
1296
- layout?: (ctx: FamilyLayoutContext) => FamilyLayoutResult | PositionedDiagram;
1297
- /** Optional: family-specific SVG renderer fed by a positioned layout result. */
1298
- renderSvg?: (ctx: RenderContext<PositionedDiagram>) => string;
1299
- /**
1300
- * Optional: family-specific SceneGraph lowering (SPEC §3.1). Produces the
1301
- * semantic render-mark tree that style backends consume; renderSvg for a
1302
- * lowered family is DefaultBackend serialization of this scene.
1303
- */
1304
- lowerScene?: (ctx: RenderContext<PositionedDiagram>) => SceneDoc;
1305
- /** Optional: family-specific ASCII renderer. */
1306
- renderAscii?: (ctx: AsciiContext) => string;
1307
- }
1308
- interface BuiltinFamilyMetadata {
1309
- /** Built-in DiagramKind exposed by Agentic Mermaid. */
1310
- id: DiagramKind;
1311
- /** Human-facing family name used in docs and editor examples. */
1312
- label: string;
1313
- /** Mermaid headers routed to this family. */
1314
- headers: readonly string[];
1315
- /** SDK narrower advertised for structured mutation. */
1316
- narrower: `as${string}`;
1317
- /** Editor example category label. */
1318
- editorDiagramType: string;
1319
- /** Basic editor example that must exist for this family. */
1320
- editorExampleId: string;
1321
- /** Short glyph used by the editor example picker. */
1322
- editorGlyph: string;
1323
- /** Minimal canonical source: correct header + core syntax. Exposed via
1324
- * `am capabilities` so agents learn each family's dialect from the
1325
- * discovery envelope instead of error-message trial-and-error (the
1326
- * onboarding probes burned most of their iterations on exactly this —
1327
- * architecture-beta headers, quadrant [x, y] brackets). A test pins
1328
- * every example to parse, verify, and render clean. */
1329
- example: string;
1330
- }
1331
- declare const BUILTIN_FAMILY_METADATA: readonly [{
1332
- readonly id: "flowchart";
1333
- readonly label: "Flowchart";
1334
- readonly headers: readonly ["flowchart", "graph"];
1335
- readonly narrower: "asFlowchart";
1336
- readonly editorDiagramType: "Flowchart";
1337
- readonly editorExampleId: "flowchart-basic";
1338
- readonly editorGlyph: "F";
1339
- readonly example: "flowchart TD\n A[Start] --> B{Ship?}\n B -->|yes| C[Deploy]\n B -->|no| D[Fix]";
1340
- }, {
1341
- readonly id: "state";
1342
- readonly label: "State";
1343
- readonly headers: readonly ["stateDiagram", "stateDiagram-v2"];
1344
- readonly narrower: "asState";
1345
- readonly editorDiagramType: "State";
1346
- readonly editorExampleId: "state-basic";
1347
- readonly editorGlyph: "S";
1348
- readonly example: "stateDiagram-v2\n [*] --> Draft\n Draft --> Review : submit\n Review --> [*] : approve";
1349
- }, {
1350
- readonly id: "sequence";
1351
- readonly label: "Sequence";
1352
- readonly headers: readonly ["sequenceDiagram"];
1353
- readonly narrower: "asSequence";
1354
- readonly editorDiagramType: "Sequence";
1355
- readonly editorExampleId: "sequence-basic";
1356
- readonly editorGlyph: "Q";
1357
- readonly example: "sequenceDiagram\n participant U as User\n participant S as Server\n U->>S: request\n S-->>U: response";
1358
- }, {
1359
- readonly id: "timeline";
1360
- readonly label: "Timeline";
1361
- readonly headers: readonly ["timeline"];
1362
- readonly narrower: "asTimeline";
1363
- readonly editorDiagramType: "Timeline";
1364
- readonly editorExampleId: "timeline-basic";
1365
- readonly editorGlyph: "T";
1366
- readonly example: "timeline\n title Roadmap\n 2025 : Alpha : Beta\n 2026 : GA";
1367
- }, {
1368
- readonly id: "class";
1369
- readonly label: "Class";
1370
- readonly headers: readonly ["classDiagram"];
1371
- readonly narrower: "asClass";
1372
- readonly editorDiagramType: "Class";
1373
- readonly editorExampleId: "class-basic";
1374
- readonly editorGlyph: "C";
1375
- readonly example: "classDiagram\n class Account {\n +id: string\n +close() void\n }\n Account <|-- Savings\n Account \"1\" o-- \"*\" Transaction : logs";
1376
- }, {
1377
- readonly id: "er";
1378
- readonly label: "ER";
1379
- readonly headers: readonly ["erDiagram"];
1380
- readonly narrower: "asEr";
1381
- readonly editorDiagramType: "ER";
1382
- readonly editorExampleId: "er-basic";
1383
- readonly editorGlyph: "ER";
1384
- readonly example: "erDiagram\n CUSTOMER ||--o{ ORDER : places\n ORDER {\n string id\n }";
1385
- }, {
1386
- readonly id: "journey";
1387
- readonly label: "Journey";
1388
- readonly headers: readonly ["journey"];
1389
- readonly narrower: "asJourney";
1390
- readonly editorDiagramType: "Journey";
1391
- readonly editorExampleId: "journey-basic";
1392
- readonly editorGlyph: "J";
1393
- readonly example: "journey\n title Checkout\n section Browse\n Find product: 4: Shopper\n section Buy\n Pay: 3: Shopper";
1394
- }, {
1395
- readonly id: "architecture";
1396
- readonly label: "Architecture";
1397
- readonly headers: readonly ["architecture-beta"];
1398
- readonly narrower: "asArchitecture";
1399
- readonly editorDiagramType: "Architecture";
1400
- readonly editorExampleId: "architecture-basic";
1401
- readonly editorGlyph: "A";
1402
- readonly example: "architecture-beta\n group backend(cloud)[Backend]\n service api(server)[API] in backend\n service db(database)[Database] in backend\n service cache(disk)[Cache] in backend\n api:R --> L:db\n api:B -[reads]-> T:cache";
1403
- }, {
1404
- readonly id: "xychart";
1405
- readonly label: "XY chart";
1406
- readonly headers: readonly ["xychart", "xychart-beta"];
1407
- readonly narrower: "asXyChart";
1408
- readonly editorDiagramType: "XY Chart";
1409
- readonly editorExampleId: "xychart-basic";
1410
- readonly editorGlyph: "XY";
1411
- readonly example: "xychart-beta\n title \"Revenue\"\n x-axis [Q1, Q2, Q3]\n y-axis \"USD\" 0 --> 100\n bar [45, 62, 80]";
1412
- }, {
1413
- readonly id: "pie";
1414
- readonly label: "Pie";
1415
- readonly headers: readonly ["pie"];
1416
- readonly narrower: "asPie";
1417
- readonly editorDiagramType: "Pie";
1418
- readonly editorExampleId: "pie-basic";
1419
- readonly editorGlyph: "P";
1420
- readonly example: "pie title Plans\n \"Free\" : 60\n \"Pro\" : 30\n \"Enterprise\" : 10";
1421
- }, {
1422
- readonly id: "quadrant";
1423
- readonly label: "Quadrant";
1424
- readonly headers: readonly ["quadrantChart"];
1425
- readonly narrower: "asQuadrant";
1426
- readonly editorDiagramType: "Quadrant";
1427
- readonly editorExampleId: "quadrant-basic";
1428
- readonly editorGlyph: "4Q";
1429
- readonly example: "quadrantChart\n title Prioritize\n x-axis Low Effort --> High Effort\n y-axis Low Value --> High Value\n Quick win: [0.2, 0.8]\n Money pit: [0.8, 0.2]";
1430
- }, {
1431
- readonly id: "gantt";
1432
- readonly label: "Gantt";
1433
- readonly headers: readonly ["gantt"];
1434
- readonly narrower: "asGantt";
1435
- readonly editorDiagramType: "Gantt";
1436
- readonly editorExampleId: "gantt-basic";
1437
- readonly editorGlyph: "G";
1438
- readonly example: "gantt\n title Plan\n dateFormat YYYY-MM-DD\n section Build\n Implement :a1, 2026-01-05, 5d\n Review :after a1, 2d";
1439
- }];
1440
- type BuiltinFamilyId = typeof BUILTIN_FAMILY_METADATA[number]['id'];
1441
- type BuiltinFamilyMetadataCoversDiagramKind = [
1442
- Exclude<DiagramKind, BuiltinFamilyId>,
1443
- Exclude<BuiltinFamilyId, DiagramKind>
1444
- ] extends [never, never] ? true : never;
1445
- declare const BUILTIN_FAMILY_METADATA_COVERS_DIAGRAM_KIND: BuiltinFamilyMetadataCoversDiagramKind;
1446
- declare function builtinFamilyMetadata(kind: DiagramKind): BuiltinFamilyMetadata | undefined;
1447
- declare function registerFamily(plugin: FamilyPlugin): void;
1448
- declare function getFamily(kind: DiagramKind): FamilyPlugin | undefined;
1449
- declare function knownFamilies(): DiagramKind[];
1450
-
1451
- declare function parseMermaid(source: string): Result<ValidDiagram, ParseError[]>;
1452
-
1453
- interface SerializeOptions {
1454
- /**
1455
- * Wrapper emission policy. 'verbatim' (default) re-emits the leading source
1456
- * wrapper (frontmatter, init directives, comments) byte-identically from
1457
- * `meta.wrapperSource`. 'canonical' synthesizes Mermaid's documented shape
1458
- * instead: one frontmatter block with `title`/`displayMode` at the top
1459
- * level and everything else nested under `config:`, init directives folded
1460
- * in (re-emitted raw only when their payload could not be folded), and
1461
- * wrapper comments dropped. Diagrams without a captured wrapper (e.g.
1462
- * synthesized from JSON payloads) always use canonical synthesis.
1463
- */
1464
- wrapper?: 'verbatim' | 'canonical';
1465
- }
1466
- declare function serializeMermaid(d: ValidDiagram, opts?: SerializeOptions): string;
1467
- declare function synthesizeFromGraph(payload: ValidDiagramPayload): Result<ValidDiagram, ParseError[]>;
1468
-
1469
- interface CreateMermaidOptions {
1470
- /** Layout direction for flowchart/state diagrams (default TD). Ignored elsewhere. */
1471
- direction?: Direction;
1472
- }
1473
- /** A mutation failure annotated with which op in the build list failed. */
1474
- type BuildError = MutationError & {
1475
- opIndex: number;
1476
- };
1477
- declare function createMermaid(kind: 'flowchart', opts?: CreateMermaidOptions): FlowchartValidDiagram;
1478
- declare function createMermaid(kind: 'state', opts?: CreateMermaidOptions): StateValidDiagram;
1479
- declare function createMermaid(kind: 'sequence', opts?: CreateMermaidOptions): SequenceValidDiagram;
1480
- declare function createMermaid(kind: 'timeline', opts?: CreateMermaidOptions): TimelineValidDiagram;
1481
- declare function createMermaid(kind: 'class', opts?: CreateMermaidOptions): ClassValidDiagram;
1482
- declare function createMermaid(kind: 'er', opts?: CreateMermaidOptions): ErValidDiagram;
1483
- declare function createMermaid(kind: 'journey', opts?: CreateMermaidOptions): JourneyValidDiagram;
1484
- declare function createMermaid(kind: 'architecture', opts?: CreateMermaidOptions): ArchitectureValidDiagram;
1485
- declare function createMermaid(kind: 'xychart', opts?: CreateMermaidOptions): XyChartValidDiagram;
1486
- declare function createMermaid(kind: 'pie', opts?: CreateMermaidOptions): PieValidDiagram;
1487
- declare function createMermaid(kind: 'quadrant', opts?: CreateMermaidOptions): QuadrantValidDiagram;
1488
- declare function createMermaid(kind: 'gantt', opts?: CreateMermaidOptions): GanttValidDiagram;
1489
- declare function createMermaid(kind: DiagramKind, opts?: CreateMermaidOptions): MutableValidDiagram;
1490
- declare function buildMermaid(kind: 'flowchart', ops: FlowchartMutationOp[], opts?: CreateMermaidOptions): Result<FlowchartValidDiagram, BuildError>;
1491
- declare function buildMermaid(kind: 'state', ops: StateMutationOp[], opts?: CreateMermaidOptions): Result<StateValidDiagram, BuildError>;
1492
- declare function buildMermaid(kind: 'sequence', ops: SequenceMutationOp[], opts?: CreateMermaidOptions): Result<SequenceValidDiagram, BuildError>;
1493
- declare function buildMermaid(kind: 'timeline', ops: TimelineMutationOp[], opts?: CreateMermaidOptions): Result<TimelineValidDiagram, BuildError>;
1494
- declare function buildMermaid(kind: 'class', ops: ClassMutationOp[], opts?: CreateMermaidOptions): Result<ClassValidDiagram, BuildError>;
1495
- declare function buildMermaid(kind: 'er', ops: ErMutationOp[], opts?: CreateMermaidOptions): Result<ErValidDiagram, BuildError>;
1496
- declare function buildMermaid(kind: 'journey', ops: JourneyMutationOp[], opts?: CreateMermaidOptions): Result<JourneyValidDiagram, BuildError>;
1497
- declare function buildMermaid(kind: 'architecture', ops: ArchitectureMutationOp[], opts?: CreateMermaidOptions): Result<ArchitectureValidDiagram, BuildError>;
1498
- declare function buildMermaid(kind: 'xychart', ops: XyChartMutationOp[], opts?: CreateMermaidOptions): Result<XyChartValidDiagram, BuildError>;
1499
- declare function buildMermaid(kind: 'pie', ops: PieMutationOp[], opts?: CreateMermaidOptions): Result<PieValidDiagram, BuildError>;
1500
- declare function buildMermaid(kind: 'quadrant', ops: QuadrantMutationOp[], opts?: CreateMermaidOptions): Result<QuadrantValidDiagram, BuildError>;
1501
- declare function buildMermaid(kind: 'gantt', ops: GanttMutationOp[], opts?: CreateMermaidOptions): Result<GanttValidDiagram, BuildError>;
1502
- declare function buildMermaid(kind: DiagramKind, ops: AnyMutationOp[], opts?: CreateMermaidOptions): Result<MutableValidDiagram, BuildError>;
1503
-
1504
- declare function edgeIdOf(edge: MermaidEdge, idx?: number): string;
1505
-
1506
- declare function mutate(d: FlowchartValidDiagram, op: FlowchartMutationOp): Result<FlowchartValidDiagram, MutationError>;
1507
- declare function mutate(d: StateValidDiagram, op: StateMutationOp): Result<StateValidDiagram, MutationError>;
1508
- declare function mutate(d: SequenceValidDiagram, op: SequenceMutationOp): Result<SequenceValidDiagram, MutationError>;
1509
- declare function mutate(d: TimelineValidDiagram, op: TimelineMutationOp): Result<TimelineValidDiagram, MutationError>;
1510
- declare function mutate(d: ClassValidDiagram, op: ClassMutationOp): Result<ClassValidDiagram, MutationError>;
1511
- declare function mutate(d: ErValidDiagram, op: ErMutationOp): Result<ErValidDiagram, MutationError>;
1512
- declare function mutate(d: JourneyValidDiagram, op: JourneyMutationOp): Result<JourneyValidDiagram, MutationError>;
1513
- declare function mutate(d: ArchitectureValidDiagram, op: ArchitectureMutationOp): Result<ArchitectureValidDiagram, MutationError>;
1514
- declare function mutate(d: XyChartValidDiagram, op: XyChartMutationOp): Result<XyChartValidDiagram, MutationError>;
1515
- declare function mutate(d: PieValidDiagram, op: PieMutationOp): Result<PieValidDiagram, MutationError>;
1516
- declare function mutate(d: QuadrantValidDiagram, op: QuadrantMutationOp): Result<QuadrantValidDiagram, MutationError>;
1517
- declare function mutate(d: GanttValidDiagram, op: GanttMutationOp): Result<GanttValidDiagram, MutationError>;
1518
- declare function mutate(d: MutableValidDiagram, op: AnyMutationOp): Result<MutableValidDiagram, MutationError>;
1519
- /**
1520
- * mutate with a shape check in front — the one choke point every UNTYPED edit
1521
- * path funnels through: the declarative applyOps/buildChecked entrypoints, the
1522
- * Code Mode facade, and the CLI `--op`/`--ops` path. Typed callers keep using
1523
- * `mutate` directly, where the compiler already guarantees op shape;
1524
- * `mutateChecked` restores that guarantee at the boundaries where ops arrive as
1525
- * raw JSON.
1526
- *
1527
- * `validateOp` proves the op's SHAPE (field names, primitive types, enums)
1528
- * BEFORE the mutator runs, so a malformed op is rejected with a prescriptive
1529
- * INVALID_OP error instead of silently mangling the diagram. Semantics — does
1530
- * the referenced node exist, is the id a duplicate — stay in the mutator, which
1531
- * runs second on a shape-proven op. Result shape is identical to `mutate`, so
1532
- * this is a drop-in wherever the raw mutator was called with untyped ops.
1533
- */
1534
- declare function mutateChecked(d: MutableValidDiagram, op: unknown): Result<MutableValidDiagram, MutationError>;
1535
-
1536
- declare const MUTATION_OPS_BY_FAMILY: {
1537
- readonly flowchart: readonly ["add_node", "remove_node", "rename_node", "set_label", "add_edge", "remove_edge"];
1538
- readonly state: readonly ["add_state", "remove_state", "rename_state", "set_state_label", "add_transition", "remove_transition", "set_transition_label", "make_composite"];
1539
- readonly sequence: readonly ["add_participant", "remove_participant", "add_message", "remove_message", "set_message_text"];
1540
- 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"];
1541
- readonly class: readonly ["set_title", "add_class", "remove_class", "rename_class", "add_member", "remove_member", "add_relation", "remove_relation", "add_note", "remove_note"];
1542
- readonly er: readonly ["add_entity", "remove_entity", "rename_entity", "add_attribute", "remove_attribute", "add_relation", "remove_relation"];
1543
- 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"];
1544
- readonly architecture: readonly ["add_service", "remove_service", "rename_service", "set_service_label", "set_service_icon", "move_service", "add_group", "remove_group", "add_edge", "remove_edge"];
1545
- readonly xychart: readonly ["set_title", "set_x_axis", "set_y_axis", "add_series", "remove_series", "set_series_values", "set_series_name", "reorder_series"];
1546
- readonly pie: readonly ["set_title", "set_show_data", "add_slice", "remove_slice", "rename_slice", "set_slice_value", "reorder_slice"];
1547
- readonly quadrant: readonly ["set_title", "set_axis_labels", "set_quadrant_label", "add_point", "remove_point", "move_point", "rename_point"];
1548
- readonly gantt: readonly ["set_title", "add_section", "rename_section", "remove_section", "add_task", "remove_task", "rename_task", "set_task_status", "set_task_dates"];
1549
- };
1550
- type MutableFamilyId = keyof typeof MUTATION_OPS_BY_FAMILY;
1551
-
1552
- type OpFamily = MutableFamilyId;
1553
- /** True when `family` has a shape schema (i.e. is a mutable structured family). */
1554
- declare function hasOpSchema(family: string): family is OpFamily;
1555
- /**
1556
- * Structured, model-actionable validation error. `code` is always INVALID_OP
1557
- * (so it flows through the existing MutationError channel unchanged), but the
1558
- * payload names the exact problem and enumerates the legal fields so a weak
1559
- * model can self-correct in one turn.
1560
- */
1561
- interface OpValidationError {
1562
- code: 'INVALID_OP';
1563
- /** 'expected_single_op' | 'unknown_kind' | 'unknown_field' | 'missing_field' | 'wrong_type' | 'require_one_of' */
1564
- reason: string;
1565
- message: string;
1566
- family: OpFamily;
1567
- opKind?: string;
1568
- /** the offending field, when applicable */
1569
- field?: string;
1570
- /** valid field names for this op (or valid op kinds, for unknown_kind) */
1571
- validFields?: string[];
1572
- /** nearest valid name to a typo'd field/kind, when an obvious match exists */
1573
- didYouMean?: string;
1574
- }
1575
- /**
1576
- * Validate one op's SHAPE against its family schema. Returns null when valid.
1577
- * The one and only shape choke point: every untyped edit path (declarative
1578
- * applyOps / buildChecked and the Code Mode facade) calls this — through
1579
- * mutateChecked — before touching a mutator.
1580
- */
1581
- declare function validateOp(family: OpFamily, op: unknown): OpValidationError | null;
1582
- /** Machine-readable op menu for a family — { opKind: [fieldName, …] } — the
1583
- * basis for tool-discovery output. Optional fields are marked with a trailing
1584
- * `?`; the op's `kind` is implicit and omitted. */
1585
- declare function opMenu(family: OpFamily): Record<string, string[]>;
1586
- /** One field of an op, as a model needs it to fill the op correctly: the name,
1587
- * whether it is required, and a human type that spells out enum values inline
1588
- * (e.g. `one of "inheritance", "composition", …`). */
1589
- interface OpFieldDoc {
1590
- name: string;
1591
- required: boolean;
1592
- type: string;
1593
- note?: string;
1594
- }
1595
- /** Full field shapes for every op of a family — the thing a model must know to
1596
- * author a correct op without guessing (which the prescriptive INVALID_OP error
1597
- * only teaches AFTER a wrong guess). Surfaced in `am capabilities --json` and
1598
- * the declarative MCP tool descriptions so field names, required-ness, and enum
1599
- * vocabularies are discoverable up front. */
1600
- declare function describeOps(family: OpFamily): Record<string, OpFieldDoc[]>;
1601
- /** Compact one-line signatures for a family's ops — `add_relation(from, to,
1602
- * relKind, label?)` — for embedding in a tool description. Optional fields carry
1603
- * a trailing `?`; enum values are left to `describeOps`/the error to keep the
1604
- * menu short. */
1605
- declare function opSignatures(family: OpFamily): string[];
1606
-
1607
- /** A verify summary reduced to plain JSON (no RenderedLayout proxy graph). */
1608
- interface VerifySummary {
1609
- ok: boolean;
1610
- warnings: VerifyResult['warnings'];
1611
- }
1612
- /** A mutation failure annotated with which op in the list failed. */
1613
- type CheckedBuildError = MutationError & {
1614
- opIndex: number;
1615
- };
1616
19
  /**
1617
- * THE single output DTO for the declarative surface. Success and failure share
1618
- * one shape: `ok` discriminates. Every field is plain JSON — safe to return
1619
- * straight out as an MCP tool result and safe to JSON round-trip: no
1620
- * `{ok,value}`-vs-plain split, no provenance proxy, no Map.
1621
- */
1622
- type OpEnvelope = {
1623
- ok: true;
1624
- family: DiagramKind;
1625
- /** canonical Mermaid source of the mutated diagram */
1626
- source: string;
1627
- verify: VerifySummary;
1628
- } | {
1629
- ok: false;
1630
- family: OpFamily | DiagramKind | null;
1631
- /** index of the failing op within the batch, when the failure is op-scoped */
1632
- opIndex?: number;
1633
- error: OpValidationError | {
1634
- code: string;
1635
- message: string;
1636
- };
1637
- };
1638
- /** Drop the layout proxy graph; keep the model-actionable verdict. The JSON
1639
- * round-trip guarantees no residual Map / prototype leaks through. */
1640
- declare function verifySummary(v: VerifyResult): VerifySummary;
1641
- /**
1642
- * buildMermaid's contract (createMermaid → fold ops) with the shape check in
1643
- * front of every op. Same Result shape as buildMermaid, so it is a drop-in for
1644
- * the untyped build path (Code Mode facade `buildMermaid`, declarative `build`).
1645
- */
1646
- declare function buildChecked(kind: DiagramKind, ops: unknown[], opts?: CreateMermaidOptions): Result<MutableValidDiagram, CheckedBuildError>;
1647
- interface ApplyOpsInput {
1648
- /** Existing Mermaid `source` to edit, OR `family` to author from blank. */
1649
- source?: string;
1650
- family?: string;
1651
- ops: unknown;
1652
- }
1653
- /**
1654
- * Plain-JSON-in / plain-JSON-out batch edit. Fail-fast, all-or-nothing: ops
1655
- * apply in order over a working copy; the first invalid or semantically-rejected
1656
- * op stops the batch and reports its index — nothing is committed (the input
1657
- * `source` is untouched, mirroring buildMermaid). Returns the canonical envelope.
1658
- */
1659
- declare function applyOps(input: ApplyOpsInput): OpEnvelope;
1660
-
1661
- declare function verifyMermaid(input: ValidDiagram | string, opts?: VerifyOptions): VerifyResult;
1662
-
1663
- interface QualityMetrics {
1664
- edgeCrossings: number;
1665
- labelLegibility: number;
1666
- whitespaceBalance: number;
1667
- labelEdgeProximity: number;
1668
- aspectRatio: number;
1669
- nodeCount: number;
1670
- edgeCount: number;
1671
- }
1672
- interface QualityBounds {
1673
- /** Max edge crossings per (edge × edge) pair. Default 0.05 = 5%. */
1674
- maxCrossingsRatio?: number;
1675
- /** Min label legibility. Default 0.85 = 85% of labels fit. */
1676
- minLabelLegibility?: number;
1677
- /** Whitespace fill band [min, max]. Default [0.05, 0.55]. */
1678
- whitespaceBand?: [number, number];
1679
- /** Min pixels between any edge-label bbox and a non-attached node, another edge-label, or another edge path. Default 4. */
1680
- minLabelEdgeProximity?: number;
1681
- /** Aspect ratio band [min, max]. Default [0.2, 5.0]. */
1682
- aspectBand?: [number, number];
1683
- }
1684
- declare const DEFAULT_BOUNDS: Required<QualityBounds>;
1685
- type BoundBasis = 'evidence' | 'derived' | 'chosen' | 'sanity';
1686
- type ViolationSeverity = 'primary' | 'secondary' | 'sanity';
1687
- interface BoundProvenance {
1688
- basis: BoundBasis;
1689
- severity: ViolationSeverity;
1690
- note: string;
1691
- }
1692
- /** Per-metric provenance. Keyed by the QualityMetrics field each bound gates. */
1693
- declare const BOUND_PROVENANCE: Record<'edgeCrossings' | 'labelLegibility' | 'whitespaceBalance' | 'labelEdgeProximity' | 'aspectRatio', BoundProvenance>;
1694
- declare function measureQuality(layout: RenderedLayout): QualityMetrics;
1695
- interface RankedViolation {
1696
- metric: keyof typeof BOUND_PROVENANCE;
1697
- severity: ViolationSeverity;
1698
- message: string;
1699
- }
1700
- interface QualityVerdict {
1701
- ok: boolean;
1702
- metrics: QualityMetrics;
1703
- /** Human-readable violation strings. Backward-compatible. */
1704
- violations: string[];
1705
- /**
1706
- * The same violations, each tagged with its evidence-based severity so a
1707
- * consumer can weight a crossings violation above a whitespace one
1708
- * (Purchase 1997/2002). Ordered primary → secondary → sanity.
1709
- */
1710
- ranked: RankedViolation[];
1711
- }
1712
- declare function checkQuality(layout: RenderedLayout, bounds?: QualityBounds): QualityVerdict;
1713
-
1714
- type LayoutCertificateProof = 'edge-route' | 'region-containment';
1715
- declare function layoutCertificateProof(cert: LayoutRouteCertificate): LayoutCertificateProof;
1716
-
1717
- type RegionKind = 'node' | 'edge' | 'label' | 'subgraph';
1718
- type AsciiWarningCode = 'ASCII_RENDER_FAILED' | 'ASCII_EDGE_REGION_UNMAPPED';
1719
- interface AsciiWarning {
1720
- code: AsciiWarningCode;
1721
- message: string;
1722
- severity: 'degraded';
1723
- }
1724
- declare const ASCII_ROUTE_PARITY_CONTRACT: {
1725
- readonly version: 1;
1726
- readonly routeIntent: "shared-route-classes";
1727
- readonly svgSource: "route-contract classifyRoutes() + certificates";
1728
- readonly asciiSource: "grid router seeded with classifyRoutes() routeClass metadata, longest-path layering, and direct-lane-first routing";
1729
- readonly degradationWarnings: readonly ["ASCII_RENDER_FAILED", "ASCII_EDGE_REGION_UNMAPPED"];
1730
- };
1731
- interface AsciiRegion {
1732
- kind: RegionKind;
1733
- /** Stable identifier for the diagram element (e.g. node id, participant id). */
1734
- id: string;
1735
- /** Optional 1-based source line where the element was declared, when known. */
1736
- sourceLine?: number;
1737
- /** 0-based row in the rendered canvas where the region starts. */
1738
- canvasRow: number;
1739
- /** 0-based column where the region starts (inclusive). */
1740
- canvasColStart: number;
1741
- /** 0-based column where the region ends (exclusive). */
1742
- canvasColEnd: number;
1743
- /** Optional row count when the region spans multiple lines (boxed node). */
1744
- rowSpan?: number;
1745
- }
1746
- interface AsciiWithMeta {
1747
- ascii: string;
1748
- regions: AsciiRegion[];
1749
- warnings: AsciiWarning[];
1750
- routeParity: typeof ASCII_ROUTE_PARITY_CONTRACT;
1751
- }
1752
- declare function renderMermaidASCIIWithMeta(input: string, opts?: AsciiRenderOptions): AsciiWithMeta;
1753
-
1754
- interface DescribeOptions {
1755
- /** 'text' (default): prose summary. 'json': structured AX tree (#7349). 'facts': deterministic semantic facts. */
1756
- format?: 'text' | 'json' | 'facts';
1757
- }
1758
- /** Structured accessibility tree (#7349): the graph as a list of nodes + edges. */
1759
- interface DescribeTree {
1760
- kind: string;
1761
- nodes: Array<{
1762
- id: string;
1763
- label: string;
1764
- }>;
1765
- edges: Array<{
1766
- from: string;
1767
- to: string;
1768
- label?: string;
1769
- }>;
1770
- entryPoints: string[];
1771
- sinks: string[];
1772
- }
1773
- declare function describeMermaidSource(source: string, opts?: DescribeOptions): string;
1774
- declare function describeMermaid(d: ValidDiagram, opts?: DescribeOptions): string;
1775
- /**
1776
- * #7349: machine-readable accessibility tree — the graph as a flat node/edge
1777
- * list with entry points and sinks. More useful to agents and screen-reader
1778
- * tooling than prose. Covers the structured families; source-level/opaque
1779
- * families expose extracted labels as nodes and no edges.
1780
- */
1781
- declare function describeMermaidTree(d: ValidDiagram): DescribeTree;
1782
-
1783
- declare function analyzeMermaid(d: ValidDiagram): DiagramAnalysis;
1784
- declare function analyzeMermaidSource(source: string): Result<DiagramAnalysis, ParseError[]>;
1785
- declare function collectActionRecords(d: ValidDiagram): DiagramActionRecord[];
1786
-
1787
- /**
1788
- * Reverse an ASCII flowchart render back to (best-effort) Mermaid source.
1789
- * Returns synthesized ids (N0, N1, …) with recovered labels and edges.
1790
- */
1791
- declare function asciiToMermaid(ascii: string, opts?: {
1792
- direction?: 'TD' | 'LR';
1793
- }): Result<string, ParseError[]>;
1794
-
1795
- declare function renderMermaidSVG(input: ValidDiagram | string, opts?: Parameters<typeof renderMermaidSVG$1>[1]): string;
1796
- declare function renderMermaidASCII(input: ValidDiagram | string, opts?: Parameters<typeof renderMermaidASCII$1>[1]): string;
1797
- interface LayoutMermaidOptions {
1798
- debug?: boolean;
1799
- regions?: boolean;
1800
- actions?: boolean;
1801
- }
1802
- declare function layoutMermaid(d: ValidDiagram, opts?: LayoutMermaidOptions): RenderedLayout;
1803
-
1804
- interface PngOptions {
1805
- /** Output scale multiplier (default 2 — retina). */
1806
- scale?: number;
1807
- /** Background color, any CSS color string (default 'white'). */
1808
- background?: string;
1809
- /** Constrain output dimensions; otherwise honors scale on the SVG bounds. */
1810
- fitTo?: {
1811
- width?: number;
1812
- height?: number;
1813
- };
1814
- /** Style name | spec | stack, same as RenderOptions.style. Faces referenced
1815
- * by the built-in looks are bundled in assets/fonts/; other families fall
1816
- * back to DejaVu Sans unless supplied via fontDirs. */
1817
- style?: StyleInput | StyleInput[];
1818
- /** Ink-wobble seed for styled looks, same as RenderOptions.seed. */
1819
- seed?: number;
1820
- /** Extra font directories searched in addition to the bundled ones —
1821
- * the escape hatch for custom styles that reference unbundled families. */
1822
- fontDirs?: string[];
1823
- }
1824
- /**
1825
- * Render a Mermaid diagram (source string or ValidDiagram) to a PNG byte array.
20
+ * Render a Mermaid diagram (source string or ParsedDiagram) to a PNG byte array.
1826
21
  * Deterministic within one runtime; cross-runtime parity is guarded for
1827
22
  * same-machine Bun ≡ Node on x86_64/ARM64 when Node + built dist are present.
1828
23
  *
@@ -1830,6 +25,70 @@ interface PngOptions {
1830
25
  * the CLI/MCP integration straightforward. Library consumers can wrap in
1831
26
  * `Promise.resolve()` if they want async semantics.
1832
27
  */
1833
- declare function renderMermaidPNG(input: ValidDiagram | string, opts?: PngOptions): Uint8Array;
28
+ declare function renderMermaidPNG(input: ParsedDiagram | string, opts?: PngOptions): Uint8Array;
29
+ interface RenderedPng {
30
+ png: Uint8Array;
31
+ receipt: RenderRequestReceipt;
32
+ /** Artifact/runtime provenance; deliberately excluded from request digests. */
33
+ runtime: PngRuntimeProvenance;
34
+ }
35
+ declare function renderMermaidPNGWithReceipt(input: ParsedDiagram | string, opts?: PngOptions): RenderedPng;
36
+ /** Trusted Node/Bun host policy; never copied into RenderOptions or receipts. */
37
+ interface MermaidPNGRendererHostOptions {
38
+ readonly backendPolicy?: HostBackendPolicy;
39
+ }
40
+ interface MermaidPNGRenderer {
41
+ renderMermaidPNG(input: ParsedDiagram | string, opts?: PngOptions): Uint8Array;
42
+ renderMermaidPNGWithReceipt(input: ParsedDiagram | string, opts?: PngOptions): RenderedPng;
43
+ }
44
+ /** Bind the native PNG adapter to a trusted in-process graphical backend. */
45
+ declare function createMermaidPNGRenderer(hostOptions?: MermaidPNGRendererHostOptions): MermaidPNGRenderer;
46
+
47
+ type RendererActionFormat = 'svg' | 'png' | 'ascii' | 'unicode';
48
+ type RendererActionDisposition = 'embedded-inert' | 'sidecar-only';
49
+ interface RendererAction extends DiagramActionRecord {
50
+ surface: RendererActionFormat;
51
+ disposition: RendererActionDisposition;
52
+ /** Surface-coordinate hit region, absent when the target was not rendered. */
53
+ region?: RenderedRegion;
54
+ }
55
+ interface RendererActionSurface {
56
+ version: 1;
57
+ format: RendererActionFormat;
58
+ coordinateSpace: 'pixel' | 'cell';
59
+ /** Only regions referenced by at least one action. */
60
+ regions: RenderedRegion[];
61
+ /** Callbacks remain metadata-only and `executable` is always false. */
62
+ actions: RendererAction[];
63
+ }
64
+ type RenderMermaidActionRequest = {
65
+ format: 'svg';
66
+ options?: RenderOptions;
67
+ } | {
68
+ format: 'png';
69
+ options?: PngOptions;
70
+ } | {
71
+ format: 'ascii' | 'unicode';
72
+ options?: AsciiRenderOptions;
73
+ };
74
+ type RenderedActionArtifact = {
75
+ format: 'svg';
76
+ output: string;
77
+ actionSurface: RendererActionSurface;
78
+ } | {
79
+ format: 'png';
80
+ output: Uint8Array;
81
+ actionSurface: RendererActionSurface;
82
+ } | {
83
+ format: 'ascii' | 'unicode';
84
+ output: string;
85
+ actionSurface: RendererActionSurface;
86
+ warnings: AsciiWarning[];
87
+ };
88
+ /**
89
+ * Render SVG, PNG, ASCII, or Unicode and return one renderer-neutral inert
90
+ * action/hit-region sidecar. The ordinary byte/string render APIs are unchanged.
91
+ */
92
+ declare function renderMermaidWithActions(input: ParsedDiagram | string, request: RenderMermaidActionRequest): RenderedActionArtifact;
1834
93
 
1835
- export { ASCII_ROUTE_PARITY_CONTRACT, type Accessibility, type AnyMutationOp, type ApplyOpsInput, type ArchitectureBody, type ArchitectureEdge, type ArchitectureEndpoint, type ArchitectureGroup, type ArchitectureJunction, type ArchitectureMutationOp, type ArchitectureService, type ArchitectureSide, type ArchitectureValidDiagram, type AsciiRegion, type AsciiWarning, type AsciiWarningCode, type AsciiWithMeta, BOUND_PROVENANCE, BUILTIN_FAMILY_METADATA, BUILTIN_FAMILY_METADATA_COVERS_DIAGRAM_KIND, type BoundBasis, type BoundProvenance, type BuildError, type BuiltinFamilyId, type BuiltinFamilyMetadata, type CheckMermaidObjectSpec, type CheckMermaidResult, type CheckMermaidSpec, type CheckedBuildError, type ClassBody, type ClassMutationOp, type ClassNode, type ClassNote, type ClassRelation, type ClassRelationKind, type ClassValidDiagram, type CreateMermaidOptions, DEFAULT_BOUNDS, DEFAULT_LABEL_CHAR_CAP, type DescribeOptions, type DescribeTree, type DiagramActionKind, type DiagramActionRecord, type DiagramActionSecurity, type DiagramAnalysis, type DiagramBody, type DiagramKind, type EdgeId, EdgeRouteCertificate, type ErAttribute, type ErBody, type ErCardinality, type ErEntity, type ErMutationOp, type ErRelation, type ErValidDiagram, type ExtractedLabel, type FamilyPlugin, type FeedbackEdgeAnalysis, type Finite, type FlowchartMutationOp, type FlowchartValidDiagram, type GanttBody, type GanttBodySection, type GanttBodyTask, type GanttBodyTaskTag, type GanttMutationOp, type GanttScheduleAnalysisSummary, type GanttStatement, type GanttValidDiagram, type GroupId, type InitDirective, type JourneyBody, type JourneyMutationOp, type JourneySection, type JourneyTask, type JourneyValidDiagram, type LayoutCertificateProof, type LayoutMermaidOptions, LayoutRouteCertificate, type LayoutWarning, type MermaidFact, type MutableValidDiagram, type MutationError, type MutationOp, type NodeId, type OpEnvelope, type OpFamily, type OpFieldDoc, type OpValidationError, type ParseError, type ParticipantId, type PieBody, type PieMutationOp, type PieSlice, type PieValidDiagram, type PngOptions, type QuadrantAxis, type QuadrantBody, type QuadrantMutationOp, type QuadrantPoint, type QuadrantValidDiagram, type QualityBounds, type QualityMetrics, type QualityVerdict, type RankedViolation, RegionContainmentCertificate, type RegionKind, type RenderedLayout, type RenderedLayoutEdge, type RenderedLayoutGroup, type RenderedLayoutNode, type RenderedRegion, type RenderedRegionKind, type Result, RouteClass, type SequenceBody, type SequenceMessage, type SequenceMessageStyle, type SequenceMutationOp, type SequenceParticipant, type SequenceValidDiagram, type SerializedFlowchartGraph, type SourceComment, type SourceMap, type StateBody, type StateMutationOp, type StateNode, type StateTransition, type StateValidDiagram, StyleInput, type Tier1WarningCode, type Tier2WarningCode, type TimelineBody, type TimelineEvent, type TimelineMutationOp, type TimelinePeriod, type TimelineSection, type TimelineValidDiagram, type ValidDiagram, type ValidDiagramMeta, type ValidDiagramPayload, type VerifyOptions, type VerifyResult, type VerifySummary, type ViolationSeverity, WARNING_SEVERITY, WARNING_TIER, type WarningCode, type WarningSeverity, type WarningTier, type XyChartAxis, type XyChartAxisSpec, type XyChartBody, type XyChartMutationOp, type XyChartSeries, type XyChartValidDiagram, analyzeMermaid, analyzeMermaidSource, applyOps, asArchitecture, asClass, asEr, asFlowchart, asGantt, asJourney, asPie, asQuadrant, asSequence, asState, asTimeline, asXyChart, asciiToMermaid, buildChecked, buildMermaid, builtinFamilyMetadata, checkMermaid, checkMermaidSource, checkQuality, collectActionRecords, createMermaid, describeMermaid, describeMermaidFacts, describeMermaidFactsSource, describeMermaidSource, describeMermaidTree, describeOps, edgeIdOf, err, getFamily, hasOpSchema, knownFamilies, layoutCertificateProof, layoutMermaid, measureQuality, mutate, mutateChecked, ok, opMenu, opSignatures, parseMermaid, registerFamily, renderMermaidASCII, renderMermaidASCIIWithMeta, renderMermaidPNG, renderMermaidSVG, serializeMermaid, synthesizeFromGraph, toFinite, validateOp, verifyMermaid, verifySummary };
94
+ export { AsciiRenderOptions, AsciiWarning, DiagramActionRecord, HostBackendPolicy, type MermaidPNGRenderer, type MermaidPNGRendererHostOptions, ParsedDiagram, type PngOptions, PngOutputPolicyInput, PngRuntimeProvenance, type RenderMermaidActionRequest, RenderRequestReceipt, type RenderedActionArtifact, type RenderedPng, RenderedRegion, type RendererAction, type RendererActionDisposition, type RendererActionFormat, type RendererActionSurface, createMermaidPNGRenderer, renderMermaidPNG, renderMermaidPNGWithReceipt, renderMermaidWithActions };