agentic-mermaid 0.4.1 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENT_NATIVE.md +94 -627
- package/CHANGELOG.md +651 -0
- package/Instructions_for_agents.md +44 -23
- package/LICENSES/Khroma-MIT.txt +21 -0
- package/LICENSES/Mermaid-MIT.txt +21 -0
- package/LICENSES/es-toolkit-MIT.txt +21 -0
- package/LICENSES/pele-MIT.txt +40 -0
- package/LICENSES/zenuml-core-MIT.txt +21 -0
- package/README.md +93 -50
- package/SECURITY.md +28 -12
- package/THIRD_PARTY_NOTICES.md +60 -0
- package/assets/hero.png +0 -0
- package/dist/agent-core.d.ts +478 -210
- package/dist/agent-core.js +1 -396
- package/dist/agent.d.ts +17 -8
- package/dist/agent.js +1 -408
- package/dist/agentic-mermaid-mcp.js +1 -11
- package/dist/am.js +1 -34562
- package/dist/browser-lazy/chunks/agentic-producer-core-CC6OOLDW.js +1 -0
- package/dist/browser-lazy/chunks/architecture-QUFVKYJR.js +13 -0
- package/dist/browser-lazy/chunks/block-6J3Q63BO.js +11 -0
- package/dist/browser-lazy/chunks/builtin-backends-7SOZZHPF.js +12 -0
- package/dist/browser-lazy/chunks/c4-SQVBZAKJ.js +10 -0
- package/dist/browser-lazy/chunks/chunk-2GPK4VFF.js +5 -0
- package/dist/browser-lazy/chunks/chunk-2I4UPL7Q.js +3 -0
- package/dist/browser-lazy/chunks/chunk-2SH76OTH.js +1 -0
- package/dist/browser-lazy/chunks/chunk-2UIA2IME.js +3 -0
- package/dist/browser-lazy/chunks/chunk-4LHYF3BS.js +1 -0
- package/dist/browser-lazy/chunks/chunk-5B2Z7575.js +1 -0
- package/dist/browser-lazy/chunks/chunk-5FQ534HP.js +1 -0
- package/dist/browser-lazy/chunks/chunk-5UVGUSD6.js +1 -0
- package/dist/browser-lazy/chunks/chunk-5X6MJX3H.js +1 -0
- package/dist/browser-lazy/chunks/chunk-AMJLVPUB.js +4 -0
- package/dist/browser-lazy/chunks/chunk-BU5LHXNJ.js +3 -0
- package/dist/browser-lazy/chunks/chunk-BY2CPG6B.js +1 -0
- package/dist/browser-lazy/chunks/chunk-CN7WTBWB.js +1 -0
- package/dist/browser-lazy/chunks/chunk-CQE4HQEW.js +1 -0
- package/dist/browser-lazy/chunks/chunk-CSFUKSU6.js +1 -0
- package/dist/browser-lazy/chunks/chunk-DF6765YX.js +17 -0
- package/dist/browser-lazy/chunks/chunk-E2WMJZNM.js +1 -0
- package/dist/browser-lazy/chunks/chunk-FAIMVOX5.js +6 -0
- package/dist/browser-lazy/chunks/chunk-GVOEAY52.js +1 -0
- package/dist/browser-lazy/chunks/chunk-HLWUNUCM.js +1 -0
- package/dist/browser-lazy/chunks/chunk-ICC7HBJX.js +1 -0
- package/dist/browser-lazy/chunks/chunk-J35HAQQF.js +20 -0
- package/dist/browser-lazy/chunks/chunk-J7FFAFQF.js +1 -0
- package/dist/browser-lazy/chunks/chunk-LH7HUDKW.js +1 -0
- package/dist/browser-lazy/chunks/chunk-N5ELX7LR.js +2 -0
- package/dist/browser-lazy/chunks/chunk-NMQQMRIR.js +1 -0
- package/dist/browser-lazy/chunks/chunk-NO7ZIVRU.js +1 -0
- package/dist/browser-lazy/chunks/chunk-OZ443IVJ.js +16 -0
- package/dist/browser-lazy/chunks/chunk-PQGPS2YV.js +7 -0
- package/dist/browser-lazy/chunks/chunk-QA6GJQ4X.js +1 -0
- package/dist/browser-lazy/chunks/chunk-RIVTHZAQ.js +1 -0
- package/dist/browser-lazy/chunks/chunk-SZELX2EJ.js +1 -0
- package/dist/browser-lazy/chunks/chunk-TYZOZXUJ.js +22 -0
- package/dist/browser-lazy/chunks/chunk-UL6NDWLL.js +1 -0
- package/dist/browser-lazy/chunks/chunk-VQYYGAXP.js +1 -0
- package/dist/browser-lazy/chunks/chunk-VWVZGQE2.js +1 -0
- package/dist/browser-lazy/chunks/chunk-X2UYKWKM.js +4 -0
- package/dist/browser-lazy/chunks/chunk-YCEICNM6.js +1 -0
- package/dist/browser-lazy/chunks/chunk-Z3FDIVLN.js +20 -0
- package/dist/browser-lazy/chunks/class-5QA4SCTS.js +13 -0
- package/dist/browser-lazy/chunks/decode-63UIZGD2.js +1 -0
- package/dist/browser-lazy/chunks/elk.bundled-L4CADV5W.js +24 -0
- package/dist/browser-lazy/chunks/er-7ZSKGN7Y.js +11 -0
- package/dist/browser-lazy/chunks/eventmodeling-2BPLHWRN.js +19 -0
- package/dist/browser-lazy/chunks/flowchart-NEIMZTB5.js +4 -0
- package/dist/browser-lazy/chunks/forest-implementation-AEP24AIP.js +1 -0
- package/dist/browser-lazy/chunks/gantt-RDPIFYAF.js +11 -0
- package/dist/browser-lazy/chunks/gitgraph-N4Y5RYB7.js +9 -0
- package/dist/browser-lazy/chunks/ishikawa-LD3YBDJN.js +6 -0
- package/dist/browser-lazy/chunks/journey-6YQR5DJX.js +16 -0
- package/dist/browser-lazy/chunks/kanban-PLMJ7NBW.js +20 -0
- package/dist/browser-lazy/chunks/mermaid-yaml-runtime-QVYX4EWK.js +136 -0
- package/dist/browser-lazy/chunks/mindmap-K2UBFO3Y.js +12 -0
- package/dist/browser-lazy/chunks/packet-CUW4QY6Y.js +7 -0
- package/dist/browser-lazy/chunks/pie-7F7UUCG3.js +15 -0
- package/dist/browser-lazy/chunks/quadrant-TOONO2WC.js +10 -0
- package/dist/browser-lazy/chunks/radar-J6JVWVAX.js +16 -0
- package/dist/browser-lazy/chunks/render-core-BZOM3K7D.js +3 -0
- package/dist/browser-lazy/chunks/requirement-CMAKDJPO.js +19 -0
- package/dist/browser-lazy/chunks/sankey-AWXQEP3F.js +13 -0
- package/dist/browser-lazy/chunks/sequence-Q2RJRB4L.js +5 -0
- package/dist/browser-lazy/chunks/state-WRBFQEDX.js +4 -0
- package/dist/browser-lazy/chunks/timeline-D2KILFXM.js +6 -0
- package/dist/browser-lazy/chunks/treemap-N3VYX5D4.js +6 -0
- package/dist/browser-lazy/chunks/xychart-G73OGK66.js +16 -0
- package/dist/browser-lazy/chunks/zenuml-H4BXNYXR.js +16 -0
- package/dist/browser-lazy/index.d.ts +544 -275
- package/dist/browser-lazy/index.js +1 -1
- package/dist/browser.global.js +802 -565
- package/dist/chunk-3LGLPG33.js +2 -0
- package/dist/chunk-7CRDX2QR.js +2 -0
- package/dist/chunk-7PPW2BMO.js +2 -0
- package/dist/chunk-DQDKA5ND.js +2 -0
- package/dist/chunk-EHCMJUMD.js +52 -0
- package/dist/chunk-GVCHLSHH.js +4 -0
- package/dist/chunk-H3NCS2XZ.js +19 -0
- package/dist/chunk-JZOJ4YGS.js +201 -0
- package/dist/chunk-MKE7GNYU.js +146 -0
- package/dist/chunk-NKNFOREZ.js +2 -0
- package/dist/chunk-O7H2UX5K.js +2 -0
- package/dist/chunk-OMY6NRQD.js +58 -0
- package/dist/chunk-UA234O4M.js +4 -0
- package/dist/chunk-VUFVLGTH.js +2 -0
- package/dist/chunk-XU5LPD2D.js +2 -0
- package/dist/cli-YGGTJZH7.js +226 -0
- package/dist/elk-constructor.js +2 -0
- package/dist/elk-constructor.node.js +11 -0
- package/dist/index-EeXqJXr5.d.ts +1223 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +1 -334
- package/dist/jsonl-RPJY6YWO.js +2 -0
- package/dist/mcp-cli-63DYXTVD.js +2 -0
- package/dist/{index-BGA_-6LV.d.ts → paint-certification-6rwQjIv_.d.ts} +5283 -6173
- package/dist/server-5NEOHOFS.js +524 -0
- package/dist/svg-styles-BdnoM7AT.d.ts +724 -0
- package/dist/svg-styles.d.ts +1 -0
- package/dist/svg-styles.js +2 -0
- package/dist/svg.d.ts +13 -0
- package/dist/svg.js +2 -0
- package/dist/types-BcS52Mjt.d.ts +1360 -0
- package/dist/zenuml/chunks/appearance-UOQ5KA6O.js +1 -0
- package/dist/zenuml/chunks/builtin-backends-KDKE7YHO.js +12 -0
- package/dist/zenuml/chunks/chunk-42DXZ5C6.js +4 -0
- package/dist/zenuml/chunks/chunk-7TVYPTDW.js +1 -0
- package/dist/zenuml/chunks/chunk-EVPSMEKN.js +1 -0
- package/dist/zenuml/chunks/chunk-OXQWRSBM.js +20 -0
- package/dist/zenuml/chunks/chunk-QWX77U7G.js +2 -0
- package/dist/zenuml/chunks/chunk-RLJEI7YN.js +29 -0
- package/dist/zenuml/chunks/chunk-RZ6XK5CD.js +29 -0
- package/dist/zenuml/chunks/decode-BWERFDGK.js +1 -0
- package/dist/zenuml/chunks/mermaid-yaml-runtime-KZVU74WU.js +136 -0
- package/dist/zenuml/chunks/render-core-V5RQ737O.js +3 -0
- package/dist/zenuml/chunks/zenuml-EA2ZFRUX.js +20 -0
- package/dist/zenuml-frame.global.js +3626 -0
- package/dist/zenuml.d.ts +83 -0
- package/dist/zenuml.js +1 -0
- package/docs/MCP-DIRECTORY-LISTINGS.md +5 -1
- package/docs/README.md +59 -103
- package/docs/agent-api-cookbook.md +26 -16
- package/docs/agent-mutation-policy.md +86 -15
- package/docs/agent-workflow-examples.md +1 -1
- package/docs/api-advanced.md +385 -0
- package/docs/api.md +320 -366
- package/docs/ascii.md +40 -4
- package/docs/browser.md +46 -7
- package/docs/choosing-a-diagram.md +148 -0
- package/docs/code-mode-impact.md +1 -0
- package/docs/comparison.md +244 -28
- package/docs/computational-aesthetics-prototype-plan.md +10 -10
- package/docs/config.md +60 -2
- package/docs/custom-fonts.md +78 -21
- package/docs/diagram-families.md +160 -10
- package/docs/eventmodeling-and-zenuml.md +165 -0
- package/docs/features.md +21 -19
- package/docs/fork-differences.md +105 -32
- package/docs/getting-started.md +56 -51
- package/docs/layout-certification.md +126 -0
- package/docs/mcp-code-mode-rationale.md +20 -12
- package/docs/mcp-http-transport.md +14 -8
- package/docs/quality.md +145 -15
- package/docs/react.md +76 -31
- package/docs/style-authoring.md +23 -11
- package/docs/svg-semantic-contract.md +104 -4
- package/docs/testing-strategy.md +684 -126
- package/docs/theming.md +27 -8
- package/examples/styles/readme-hero.md +25 -0
- package/examples/styles/readme-hero.mmd +13 -0
- package/examples/styles/readme-hero.style.json +7 -0
- package/package.json +114 -57
- package/server.json +2 -2
- package/skills/agentic-mermaid-diagram-workflow/SKILL.md +26 -8
- package/skills/agentic-mermaid-diagram-workflow/references/cli.md +13 -3
- package/skills/agentic-mermaid-diagram-workflow/references/code-mode.md +2 -1
- package/skills/agentic-mermaid-diagram-workflow/references/flowchart.md +9 -6
- package/skills/agentic-mermaid-diagram-workflow/references/hosted-mcp.md +1 -0
- package/skills/agentic-mermaid-diagram-workflow/references/sequence.md +4 -3
- package/skills/agentic-mermaid-diagram-workflow/references/timeline.md +7 -6
- package/skills/agentic-mermaid-diagram-workflow/references/upstream/agentflow.md +574 -0
- package/skills/agentic-mermaid-diagram-workflow/references/upstream/architecture.md +10 -2
- package/skills/agentic-mermaid-diagram-workflow/references/upstream/c4.md +18 -0
- package/skills/agentic-mermaid-diagram-workflow/references/upstream/classDiagram.md +123 -0
- package/skills/agentic-mermaid-diagram-workflow/references/upstream/cynefin.md +6 -1
- package/skills/agentic-mermaid-diagram-workflow/references/upstream/entityRelationshipDiagram.md +129 -9
- package/skills/agentic-mermaid-diagram-workflow/references/upstream/eventmodeling.md +22 -0
- package/skills/agentic-mermaid-diagram-workflow/references/upstream/flowchart.md +188 -60
- package/skills/agentic-mermaid-diagram-workflow/references/upstream/gitgraph.md +13 -7
- package/skills/agentic-mermaid-diagram-workflow/references/upstream/mindmap.md +110 -1
- package/skills/agentic-mermaid-diagram-workflow/references/upstream/packet.md +38 -0
- package/skills/agentic-mermaid-diagram-workflow/references/upstream/requirementDiagram.md +115 -0
- package/skills/agentic-mermaid-diagram-workflow/references/upstream/sequenceDiagram.md +101 -0
- package/skills/agentic-mermaid-diagram-workflow/references/upstream/stateDiagram.md +87 -0
- package/skills/agentic-mermaid-diagram-workflow/references/upstream/swimlanes.md +105 -2
- package/skills/agentic-mermaid-diagram-workflow/references/upstream/timeline.md +12 -6
- package/skills/agentic-mermaid-diagram-workflow/references/upstream/usecase.md +953 -0
- package/skills/agentic-mermaid-diagram-workflow/references/upstream/venn.md +77 -0
- package/skills/agentic-mermaid-diagram-workflow/references/upstream/xyChart.md +1 -1
- package/dist/browser-lazy/chunks/architecture-KTHE2HX3.js +0 -31
- package/dist/browser-lazy/chunks/chunk-2XCPFAD5.js +0 -46
- package/dist/browser-lazy/chunks/chunk-3H4F7RBT.js +0 -1
- package/dist/browser-lazy/chunks/chunk-4EVLW2NJ.js +0 -1
- package/dist/browser-lazy/chunks/chunk-5Q4S74UO.js +0 -1
- package/dist/browser-lazy/chunks/chunk-6OAPWSDO.js +0 -1
- package/dist/browser-lazy/chunks/chunk-A7L4WWVW.js +0 -143
- package/dist/browser-lazy/chunks/chunk-C7FJO2I3.js +0 -4
- package/dist/browser-lazy/chunks/chunk-D3XXDKIO.js +0 -1
- package/dist/browser-lazy/chunks/chunk-DXA5WL7H.js +0 -4
- package/dist/browser-lazy/chunks/chunk-EPFMQPXX.js +0 -1
- package/dist/browser-lazy/chunks/chunk-FFOHLPDA.js +0 -2
- package/dist/browser-lazy/chunks/chunk-FLD63DXE.js +0 -2
- package/dist/browser-lazy/chunks/chunk-G6OLSHRG.js +0 -7
- package/dist/browser-lazy/chunks/chunk-GRXCKTHX.js +0 -0
- package/dist/browser-lazy/chunks/chunk-I6VE56S7.js +0 -1
- package/dist/browser-lazy/chunks/chunk-KJVNXJ5Y.js +0 -1
- package/dist/browser-lazy/chunks/chunk-L227EPFP.js +0 -11
- package/dist/browser-lazy/chunks/chunk-LNIHDJSF.js +0 -1
- package/dist/browser-lazy/chunks/chunk-M6BT2HIP.js +0 -1
- package/dist/browser-lazy/chunks/chunk-NZRUMODH.js +0 -1
- package/dist/browser-lazy/chunks/chunk-OFRMKQA6.js +0 -1
- package/dist/browser-lazy/chunks/chunk-P7HMSKHJ.js +0 -1
- package/dist/browser-lazy/chunks/chunk-PXKL3O6H.js +0 -1
- package/dist/browser-lazy/chunks/chunk-PZEWZT35.js +0 -1
- package/dist/browser-lazy/chunks/chunk-STQRDZ67.js +0 -1
- package/dist/browser-lazy/chunks/chunk-SUFMSWTX.js +0 -1
- package/dist/browser-lazy/chunks/chunk-T7IJ6V4B.js +0 -3
- package/dist/browser-lazy/chunks/chunk-UAEZO5VL.js +0 -1
- package/dist/browser-lazy/chunks/chunk-WEUWIFG3.js +0 -1
- package/dist/browser-lazy/chunks/chunk-X64T74C5.js +0 -24
- package/dist/browser-lazy/chunks/class-F7R6TJ73.js +0 -9
- package/dist/browser-lazy/chunks/er-BDK7CM5L.js +0 -9
- package/dist/browser-lazy/chunks/flowchart-KFU6XV7S.js +0 -4
- package/dist/browser-lazy/chunks/gantt-I64VVDSP.js +0 -28
- package/dist/browser-lazy/chunks/gitgraph-EDUVJ5IJ.js +0 -8
- package/dist/browser-lazy/chunks/journey-TLO2RNM3.js +0 -40
- package/dist/browser-lazy/chunks/mindmap-OJCNDYPM.js +0 -9
- package/dist/browser-lazy/chunks/pie-HVG6XO7K.js +0 -19
- package/dist/browser-lazy/chunks/quadrant-U6S2L4MJ.js +0 -24
- package/dist/browser-lazy/chunks/radar-ZDLOBTVG.js +0 -32
- package/dist/browser-lazy/chunks/render-core-Y2DFNMQG.js +0 -12
- package/dist/browser-lazy/chunks/sequence-Z4WFS3VB.js +0 -12
- package/dist/browser-lazy/chunks/state-2HV2YGN3.js +0 -4
- package/dist/browser-lazy/chunks/timeline-XM4UFPOC.js +0 -20
- package/dist/browser-lazy/chunks/xychart-7JDHWTQY.js +0 -36
- package/dist/chunk-GGXCNCNA.js +0 -4118
- package/dist/chunk-IVD4NXNE.js +0 -615
- package/dist/chunk-JDMRPUAG.js +0 -37
- package/dist/chunk-JWAAW3FH.js +0 -149
- package/dist/chunk-LCGBT32P.js +0 -62036
- package/dist/chunk-RWMZRUIC.js +0 -4715
- package/dist/mcp-cli-4MLKC3ZH.js +0 -17
- package/docs/mutation-testing.md +0 -285
package/docs/ascii.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Agentic Mermaid can render Mermaid diagrams as terminal text. Unicode box drawing is the default; 7-bit ASCII is available for logs, email, CI output, and constrained terminals.
|
|
4
4
|
|
|
5
|
+
Built-in terminal families use a [shared terminal compositor](https://github.com/adewale/agentic-mermaid/blob/main/docs/project/terminal-composition.md)
|
|
6
|
+
for owned cell geometry. ASCII/Unicode alphabet selection and plain, ANSI or
|
|
7
|
+
terminal HTML encoding derive from that drawing. SVG/PNG retain separate pixel
|
|
8
|
+
geometry; family placement and routing retain their own constraints.
|
|
9
|
+
|
|
5
10
|
## Quick start
|
|
6
11
|
|
|
7
12
|
```ts
|
|
@@ -65,7 +70,40 @@ import { renderMermaidASCIIWithMeta } from 'agentic-mermaid/agent'
|
|
|
65
70
|
const { ascii, regions, actions, warnings, routeParity } = renderMermaidASCIIWithMeta(source)
|
|
66
71
|
```
|
|
67
72
|
|
|
68
|
-
|
|
73
|
+
For built-in native terminal output, `regions` comes from the drawing retained
|
|
74
|
+
by that render. `canvasRow`, column bounds and `rowSpan` describe a primary text
|
|
75
|
+
occurrence or an explicitly allocated container/route rectangle. That rectangle
|
|
76
|
+
can include empty cells. Use `ownedCellSpans` for exact occupied cells, including
|
|
77
|
+
authored spaces and wide-character continuations; `occludedCellSpans`, when
|
|
78
|
+
present, describes relationship coverage hidden behind opaque marks. Repeated
|
|
79
|
+
labels retain separate element identities, and parent references include
|
|
80
|
+
`parentId` and `parentKind`. These fields support cell-based hit testing without
|
|
81
|
+
searching the rendered label text.
|
|
82
|
+
|
|
83
|
+
`projectedText` preserves deliberately empty rows of its primary logical text
|
|
84
|
+
occurrence, including leading and trailing rows. Separate occurrences do not
|
|
85
|
+
acquire newlines merely because they are far apart on the canvas. Empty rows
|
|
86
|
+
retain provenance without inventing occupied cells.
|
|
87
|
+
|
|
88
|
+
Family parsing retains authored identities and endpoints. Shared display
|
|
89
|
+
preparation neutralizes C0/C1 controls before pixel or cell fitting, while typed
|
|
90
|
+
IDs, connector references and action targets remain exact. XML attribute
|
|
91
|
+
serialization separately preserves identity whitespace. Sankey's CSV parser
|
|
92
|
+
receives physical authored rows, including blank rows inside quoted labels.
|
|
93
|
+
|
|
94
|
+
`actions` contains inert action metadata only; a host decides whether and how to
|
|
95
|
+
handle it. `routeParity` records route intent and projection limits; it does not
|
|
96
|
+
certify identical SVG/terminal paths or guarantee that every family layout can
|
|
97
|
+
fit. Terminal drawing does not consume SVG route certificates directly.
|
|
98
|
+
|
|
99
|
+
Inspect `warnings` for refused geometry and feature-specific projection losses.
|
|
100
|
+
An edge region with ports is not evidence that its label was painted: check its
|
|
101
|
+
owned/projected text and any collision diagnostic. Compound graph placement
|
|
102
|
+
keeps child containers atomic within their parent; parallel/reciprocal allocation
|
|
103
|
+
reserves physical ports and complete labels before routing. Bounded allocation
|
|
104
|
+
can still fail, and a diagnostic must not be treated as a successful route.
|
|
105
|
+
String-only extension hooks report `TERMINAL_OWNERSHIP_UNAVAILABLE`; metadata
|
|
106
|
+
does not invent regions from their text.
|
|
69
107
|
|
|
70
108
|
## Reversing simple flowcharts
|
|
71
109
|
|
|
@@ -86,9 +124,7 @@ not for reconstructing arbitrary Mermaid source.
|
|
|
86
124
|
## Supported families
|
|
87
125
|
|
|
88
126
|
Family support is registry-driven rather than maintained as a second list in
|
|
89
|
-
this guide. Run `am capabilities --json` for live discovery
|
|
90
|
-
[Section A capability matrix](./project/section-a-capability-report.md) records
|
|
91
|
-
terminal projection support and named losses for every registered family.
|
|
127
|
+
this guide. Run `am capabilities --json` for live discovery.
|
|
92
128
|
|
|
93
129
|
Style appearance is projected to terminal colors and glyphs. Use a
|
|
94
130
|
receipt-bearing render API to compare its `appearanceDigest` with graphical
|
package/docs/browser.md
CHANGED
|
@@ -6,12 +6,41 @@ the diagram source known before the page is served?**
|
|
|
6
6
|
| Your case | Use | JS shipped |
|
|
7
7
|
|---|---|---|
|
|
8
8
|
| Source is fixed at publish time — blog post, docs page, README | [Pre-render before delivery](#framework-neutral-pre-rendering) | none |
|
|
9
|
-
| Source is authored or edited in the page — editor, playground, user input | [Async family-loaded renderer](#async-family-loaded-esm) |
|
|
10
|
-
|
|
|
9
|
+
| Source is authored or edited in the page — editor, playground, user input | [Async family-loaded renderer](#async-family-loaded-esm) | loader plus the selected family and shared core |
|
|
10
|
+
| Synchronous source-to-SVG without editing or terminal APIs | [Focused SVG entry](#focused-synchronous-svg) | SVG families and the default backend |
|
|
11
|
+
| One classic script with a synchronous global matters more than transfer | [Compatibility bundle](#classic-one-file-compatibility-bundle) | complete renderer and library APIs |
|
|
11
12
|
|
|
12
13
|
Most sites are the first row. `renderMermaidSVG` is synchronous and needs no DOM,
|
|
13
14
|
so a static site never has to ship the renderer to a reader.
|
|
14
15
|
|
|
16
|
+
## Focused synchronous SVG
|
|
17
|
+
|
|
18
|
+
Use `agentic-mermaid/svg` when a consumer needs source-to-SVG rendering without
|
|
19
|
+
the typed editing, terminal, or PNG APIs. It uses the same request, security,
|
|
20
|
+
geometry and final-paint certification pipeline as the complete library, and
|
|
21
|
+
offers `renderMermaidSVGWithReceipt` as well as the string projection:
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { renderMermaidSVGWithReceipt } from 'agentic-mermaid/svg'
|
|
25
|
+
const { svg, receipt } = renderMermaidSVGWithReceipt('flowchart LR\n API --> DB', {
|
|
26
|
+
security: 'strict',
|
|
27
|
+
})
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
This entry accepts Mermaid source strings. Parsed diagrams and extension
|
|
31
|
+
registration remain on the complete library/agent entries. Palette changes use
|
|
32
|
+
the default backend. To enable sketch looks synchronously, explicitly import
|
|
33
|
+
`agentic-mermaid/svg/styles` before rendering with a sketch style. Browser
|
|
34
|
+
bundlers can consume the same focused ESM entry. A second monolithic SVG bundle
|
|
35
|
+
is deliberately not shipped: it would duplicate ELK in every npm installation.
|
|
36
|
+
|
|
37
|
+
The async browser entry loads optional sketch backends on demand and also
|
|
38
|
+
exports `renderMermaidSVGWithReceiptAsync`. An unloaded loader is not a usable
|
|
39
|
+
renderer: compare the complete first-family request graph when choosing an entry.
|
|
40
|
+
|
|
41
|
+
The hosted editor uses separate modules for rendering, verification, text output
|
|
42
|
+
and PNG export. The standalone `bun run editor` build remains self-contained.
|
|
43
|
+
|
|
15
44
|
## Framework-neutral pre-rendering
|
|
16
45
|
|
|
17
46
|
Pre-rendering is not tied to Alpine, React, or any other UI framework. The
|
|
@@ -291,6 +320,13 @@ artifact remains covered separately by the all-family browser contract.
|
|
|
291
320
|
Keep `security: 'strict'` for authored or user-provided source, and insert the
|
|
292
321
|
accepted result as parsed XML nodes as shown above. Do not assign renderer output
|
|
293
322
|
to `innerHTML`: strict rendering and DOM insertion are separate trust boundaries.
|
|
323
|
+
XML parsing is not a sanitizer; accept only the strict renderer's result.
|
|
324
|
+
These DOMParser examples assume Trusted Types is not enforced. Under
|
|
325
|
+
`require-trusted-types-for 'script'`, parsing is also a protected sink: supply
|
|
326
|
+
the application's reviewed, narrowly scoped TrustedHTML adapter rather than
|
|
327
|
+
adding a permissive default policy or disabling CSP. Server/build frameworks
|
|
328
|
+
likewise need their own reviewed trusted-markup boundary.
|
|
329
|
+
See [DOMParser's security and Trusted Types requirements](https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString#security_considerations).
|
|
294
330
|
The integrity value pins the reviewed bytes as well as the version. When the
|
|
295
331
|
package version changes, recompute it with:
|
|
296
332
|
|
|
@@ -391,9 +427,11 @@ file around the root export:
|
|
|
391
427
|
|
|
392
428
|
1. **Separate catalog from runtime hooks.** Family ids, header detection,
|
|
393
429
|
maturity, capabilities, and canonical examples must live in a browser-safe
|
|
394
|
-
catalog that imports no parser, layout, SVG, ASCII, or agent hooks.
|
|
395
|
-
complete registry imports those hooks
|
|
396
|
-
nominally render-only bundle
|
|
430
|
+
catalog that imports no parser, layout, SVG, ASCII, or agent hooks. The
|
|
431
|
+
complete registry imports those hooks and would pull the whole graph into a
|
|
432
|
+
nominally render-only bundle, so
|
|
433
|
+
`scripts/build/generate-browser-family-catalog.ts` generates a hook-free
|
|
434
|
+
catalog in `src/browser-lazy/generated/` instead.
|
|
397
435
|
2. **Keep one source-normalization authority.** The loader must handle BOMs,
|
|
398
436
|
frontmatter, init directives, comments, and accessibility directives with
|
|
399
437
|
the same contract as server rendering. Refactor that contract so detection
|
|
@@ -431,8 +469,9 @@ filename:
|
|
|
431
469
|
- initial and per-family request-count, raw, gzip, and Brotli budgets are
|
|
432
470
|
recorded separately.
|
|
433
471
|
|
|
434
|
-
`bun run build:browser:lazy` generates the exhaustive catalog
|
|
435
|
-
chunks
|
|
472
|
+
`bun run build:browser:lazy` generates the exhaustive catalog and builds the
|
|
473
|
+
chunks; `bun run check:browser-lazy`, which `bun run quality:check` runs once
|
|
474
|
+
per CI run, fails on dependency or size drift. `bun test
|
|
436
475
|
src/__tests__/browser-lazy.test.ts` proves all-family byte parity in-process;
|
|
437
476
|
`bun test e2e/browser-bundle.e2e.test.ts --timeout 600000` proves the emitted
|
|
438
477
|
HTTP module graph, strict-mode parity, non-ELK exclusion, and shared ELK caching
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# Choosing a diagram family
|
|
2
|
+
|
|
3
|
+
Start from the task the reader must perform. A diagram family is the result of
|
|
4
|
+
that decision, not the starting point: the same deployment can be drawn as a
|
|
5
|
+
flowchart, an architecture diagram, or a sequence diagram, and only the
|
|
6
|
+
reader's question tells you which one is right. This page routes from task to
|
|
7
|
+
family. Syntax and per-family caveats live in
|
|
8
|
+
[`diagram-families.md`](./diagram-families.md); the authoritative list of what
|
|
9
|
+
renders and what mutates is `am capabilities --json`, not this page.
|
|
10
|
+
|
|
11
|
+
## Start from the reader's task
|
|
12
|
+
|
|
13
|
+
<!-- complete: family-ids -->
|
|
14
|
+
| The reader must | First choice | Reach for instead when |
|
|
15
|
+
|---|---|---|
|
|
16
|
+
| Follow steps and decisions to an outcome | Flowchart | The subject reacts to events rather than proceeding through steps: state |
|
|
17
|
+
| See how a system moves between modes | State | The path is a linear procedure: flowchart |
|
|
18
|
+
| Read who sends what to whom, in order | Sequence | Only dependency matters, not order: flowchart |
|
|
19
|
+
| Read how protocol fields occupy bit addresses and word rows | Packet | Message order between actors matters: sequence |
|
|
20
|
+
| Compare dated work with durations and dependencies | Gantt | There are no dates, only eras: timeline |
|
|
21
|
+
| Track work by workflow stage, assignee, ticket, and priority | Kanban | Dates, durations, and dependencies matter: gantt |
|
|
22
|
+
| Scan periods and what happened in each | Timeline | The story is one person's scored experience: journey; the history is commits and branches: gitGraph |
|
|
23
|
+
| Judge how a process felt to the person in it | Journey | No actors or sentiment scores exist: timeline |
|
|
24
|
+
| Trace where quantities go from stage to stage | Sankey | The amounts don't need to balance: flowchart with labeled edges |
|
|
25
|
+
| Judge parts of one whole at one moment | Pie | Slices are many or nearly equal, or values change over time: xychart |
|
|
26
|
+
| Compare value proportions within a hierarchy | Treemap | There is no hierarchy: pie; precise comparisons matter more than area: xychart |
|
|
27
|
+
| Compare measured values across categories or time | XY chart | The values are shares of a single whole: pie |
|
|
28
|
+
| Place options on two independent axes | Quadrant | Each option is scored on three or more criteria: radar |
|
|
29
|
+
| Compare profiles across three or more shared criteria | Radar | There are exactly two criteria: quadrant |
|
|
30
|
+
| See stored data and how records relate | ER | Behavior and methods matter, not storage: class |
|
|
31
|
+
| See code structure, types, and inheritance | Class | Only the persistence shape matters: er |
|
|
32
|
+
| Trace requirements to supporting elements and verification evidence | Requirement | The subject is software types and inheritance: class |
|
|
33
|
+
| See services, their grouping, and physical links | Architecture | The flow is logical rather than deployed: flowchart |
|
|
34
|
+
| Read a deliberately arranged grid of components and nested groups | Block | Connectivity should choose placement: flowchart; infrastructure ports matter: architecture |
|
|
35
|
+
| Explain people, software responsibilities and nested system or deployment boundaries | C4 | The reader needs infrastructure ports and physical links: architecture; protocol timing: sequence |
|
|
36
|
+
| Follow commits, branches, and merges | GitGraph | — |
|
|
37
|
+
| Explore ideas radiating from one center | Mindmap | Branches share children (the structure is a graph, not a tree): flowchart |
|
|
38
|
+
| Investigate contributing causes of one effect | Ishikawa | The branches are ideas without a cause-and-effect claim: mindmap |
|
|
39
|
+
|
|
40
|
+
## Check the source shape first
|
|
41
|
+
|
|
42
|
+
Some families make source order carry meaning, and a few enforce arithmetic.
|
|
43
|
+
Know which constraints apply before you author:
|
|
44
|
+
|
|
45
|
+
- **Order is the timeline.** Sequence messages, timeline periods, journey
|
|
46
|
+
tasks, and gantt tasks mean something by their position; a gantt task with no
|
|
47
|
+
explicit start chains from the task above it. Reordering is a first-class
|
|
48
|
+
edit in these families (`move_message`, `move_period`, `move_task`), not a
|
|
49
|
+
cut-and-paste.
|
|
50
|
+
- **Sankey flows are an account.** An intermediate node that receives 100 and
|
|
51
|
+
emits 80 renders as if it carried 100, hiding the missing 20. Verification
|
|
52
|
+
names the unaccounted amount (`FLOW_IMBALANCE`); balance the links or add an
|
|
53
|
+
explicit remainder sink.
|
|
54
|
+
- **Bar length is the value.** XY chart bars grow from zero, so an authored
|
|
55
|
+
`y-axis` range that excludes zero makes lengths lie; verification names the
|
|
56
|
+
baseline the bars start from (`BAR_RANGE_EXCLUDES_ZERO`), and a range that
|
|
57
|
+
leaves values outside it names them (`VALUES_OUTSIDE_RANGE`). Many long category
|
|
58
|
+
names do not all fit under a vertical chart; verification lists the ones the
|
|
59
|
+
axis does not draw (`LABELS_HIDDEN`), and a horizontal chart lists them down
|
|
60
|
+
the side.
|
|
61
|
+
- **Values have domains.** Journey scores are finite numbers 1–5, quadrant
|
|
62
|
+
coordinates live in `[0, 1]`, pie values are positive, radar curves carry
|
|
63
|
+
one value per axis. Out-of-domain input falls back to a lossless opaque body
|
|
64
|
+
instead of a wrong render.
|
|
65
|
+
- **Labels select typed edits in the data families.** Pie slices, quadrant
|
|
66
|
+
points, and radar axes and curves use labels as mutation selectors; typed
|
|
67
|
+
add/rename operations reject collisions. Existing source can still contain
|
|
68
|
+
duplicate labels, so make those identities unique before a label-addressed
|
|
69
|
+
edit. Sankey node labels are intentionally shared across links and identify
|
|
70
|
+
the same flow node.
|
|
71
|
+
- **Terminal delivery is real delivery.** Every registered family renders
|
|
72
|
+
ASCII. A width the diagram cannot honestly meet throws `AsciiWidthError`
|
|
73
|
+
with the required width instead of squeezing the layout.
|
|
74
|
+
- **C4 interactions have occurrence identity.** Repeated endpoint pairs are
|
|
75
|
+
separate interactions. Dynamic order and explicit indices survive, while
|
|
76
|
+
generated interaction selectors can change after structural edits; read the
|
|
77
|
+
successful result before the next edit. See [C4](https://github.com/adewale/agentic-mermaid/blob/0f05d39858d0061b79a0c99ef03a5c10d537ddaa/docs/design/families/c4.md).
|
|
78
|
+
- **Bit addresses and grid cells carry meaning.** Packet ranges are inclusive;
|
|
79
|
+
descending bit numbering mirrors the display without changing field addresses.
|
|
80
|
+
Block source order, columns, spans, and spaces determine placement; connectors
|
|
81
|
+
do not rearrange that grid.
|
|
82
|
+
- **Membership is authored data.** Kanban indentation places cards in columns;
|
|
83
|
+
Ishikawa starts with the effect and uses indentation for contributing causes;
|
|
84
|
+
Treemap parentage and numeric leaf values determine containment and area.
|
|
85
|
+
Use the family's typed movement operations to change membership deliberately.
|
|
86
|
+
- **Requirement relations are typed traceability.** Containment, satisfaction,
|
|
87
|
+
verification, and the other relation kinds retain their own meaning and
|
|
88
|
+
endpoint orientation. Discover the family schema instead of borrowing
|
|
89
|
+
flowchart edge syntax.
|
|
90
|
+
|
|
91
|
+
## Prefer the smallest structure that carries the meaning
|
|
92
|
+
|
|
93
|
+
1. Start with the family's base statements: nodes and edges, states and
|
|
94
|
+
transitions, messages, tasks.
|
|
95
|
+
2. Label what the reader would otherwise guess. Every exit of a multi-exit
|
|
96
|
+
decision carries its condition; verification cites the standards that
|
|
97
|
+
require it (`DECISION_BRANCH_UNLABELED`, from ISO 5807 and ANSI X3.5).
|
|
98
|
+
3. Group only around real ownership: subgraphs, composite states, sections,
|
|
99
|
+
architecture groups. A box that answers "who owns this?" earns its border.
|
|
100
|
+
4. Adjust direction after grouping, per subgraph where supported.
|
|
101
|
+
5. Add classes and styles last. Brand color, typography, and texture belong to
|
|
102
|
+
the Style + Palette render options, not to the source.
|
|
103
|
+
|
|
104
|
+
If the construct you want is not modeled, check whether another family owns
|
|
105
|
+
that metaphor before bending this one. Source preservation does not establish
|
|
106
|
+
render support: C4 refuses a partial drawing when a retained statement has no
|
|
107
|
+
native interpretation. Check the family's documented disposition.
|
|
108
|
+
|
|
109
|
+
## Defaults that mislead
|
|
110
|
+
|
|
111
|
+
- A pie of six nearly equal slices asks the reader to compare angles, which
|
|
112
|
+
eyes do badly. Rank the values as xychart bars.
|
|
113
|
+
- A flowchart standing in for a protocol misleads because arrows read as
|
|
114
|
+
causality, not time. Message order is what sequence diagrams encode.
|
|
115
|
+
- A gantt without real dates is a timeline wearing a scheduler. The gantt
|
|
116
|
+
scheduler resolves calendars and dependencies; if nothing depends on
|
|
117
|
+
duration, timeline says the same thing with less machinery.
|
|
118
|
+
- A mindmap can only draw a tree. The moment two branches need the same
|
|
119
|
+
child, move to a flowchart.
|
|
120
|
+
- A timeline that smuggles in durations ("Q1–Q3: migration") usually wants to
|
|
121
|
+
be a gantt, where `after` and `until` make the dependency checkable.
|
|
122
|
+
- A radar comparison is honest only when every curve shares the axes and the
|
|
123
|
+
scale; set `max`/`min` explicitly rather than letting one outlier stretch
|
|
124
|
+
the grid.
|
|
125
|
+
- Today markers in gantt render only when the caller passes `ganttToday`;
|
|
126
|
+
relying on the wall clock would make the render non-reproducible, so there
|
|
127
|
+
is no implicit "today."
|
|
128
|
+
|
|
129
|
+
## Verify what the family promised
|
|
130
|
+
|
|
131
|
+
Choosing well is checkable. After authoring or editing, run `verifyMermaid`
|
|
132
|
+
(or `am verify`):
|
|
133
|
+
|
|
134
|
+
- **Tier 1 — structural:** <!-- BEGIN GENERATED: warning-codes:structural -->`EMPTY_DIAGRAM`, `EDGE_MISANCHORED`, `OFF_CANVAS`, `GROUP_BREACH`, `UNKNOWN_SHAPE`, `LABEL_OVERFLOW`, `UNRESOLVABLE_SCHEDULE`, `RENDER_FAILED`, `INTERNAL_ERROR`<!-- END GENERATED: warning-codes:structural -->
|
|
135
|
+
must be empty before committing; they mean the source or render contract is
|
|
136
|
+
broken, not merely ugly.
|
|
137
|
+
- **Tier 2 — geometric:** `NODE_OVERLAP` and route warnings flag layouts
|
|
138
|
+
worth a look; suppress them only when the geometry is intentional.
|
|
139
|
+
- **Tier 3 — lint:** the codes cited above name the family-specific mistakes
|
|
140
|
+
this page warns about. Each code's page under
|
|
141
|
+
<https://agentic-mermaid.dev/warnings/> says what triggers it and how to
|
|
142
|
+
clear it.
|
|
143
|
+
|
|
144
|
+
Two checks no lint sees: give the diagram a title or `accTitle` that states
|
|
145
|
+
the reader's question, and read the ASCII render in a terminal once, because
|
|
146
|
+
reviewers will.
|
|
147
|
+
|
|
148
|
+
The reader's task picks the family; `verify` checks what the family promised.
|
package/docs/code-mode-impact.md
CHANGED
|
@@ -45,6 +45,7 @@ environment, `globalOutbound: null`, no subrequests, and a bounded CPU budget.
|
|
|
45
45
|
The isolate configuration is the security boundary. The hardened SDK facade is
|
|
46
46
|
kept for behavioural parity with the local server.
|
|
47
47
|
|
|
48
|
+
<!-- complete: hosted-mcp-tools -->
|
|
48
49
|
Hosted execution has a per-call cost, so common pure operations do not enter
|
|
49
50
|
the sandbox. `render_svg`, `render_ascii`, `render_png`, `verify`, `describe`,
|
|
50
51
|
and `describe_sdk` run as ordinary Worker calls whose successful deterministic
|