agentic-mermaid 0.3.2 → 0.4.1

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 (59) hide show
  1. package/CHANGELOG.md +105 -0
  2. package/README.md +2 -0
  3. package/dist/agent-core.d.ts +2 -2
  4. package/dist/agent-core.js +2 -2
  5. package/dist/agent.d.ts +2 -2
  6. package/dist/agent.js +4 -4
  7. package/dist/agentic-mermaid-mcp.js +5 -5
  8. package/dist/am.js +6 -6
  9. package/dist/browser-lazy/chunks/{architecture-WMSX5L4P.js → architecture-KTHE2HX3.js} +1 -1
  10. package/dist/browser-lazy/chunks/{chunk-EX6TP7QM.js → chunk-2XCPFAD5.js} +2 -2
  11. package/dist/browser-lazy/chunks/{chunk-TDGTBGV3.js → chunk-3H4F7RBT.js} +1 -1
  12. package/dist/browser-lazy/chunks/{chunk-RLS545DI.js → chunk-4EVLW2NJ.js} +1 -1
  13. package/dist/browser-lazy/chunks/{chunk-TEH2PRKN.js → chunk-6OAPWSDO.js} +1 -1
  14. package/dist/browser-lazy/chunks/{chunk-AOCFMYYH.js → chunk-C7FJO2I3.js} +1 -1
  15. package/dist/browser-lazy/chunks/{chunk-ZZECLXC3.js → chunk-D3XXDKIO.js} +1 -1
  16. package/dist/browser-lazy/chunks/{chunk-CCTZFX43.js → chunk-DXA5WL7H.js} +1 -1
  17. package/dist/browser-lazy/chunks/{chunk-TBZAU7KC.js → chunk-G6OLSHRG.js} +1 -1
  18. package/dist/browser-lazy/chunks/{chunk-QYJMRNS3.js → chunk-L227EPFP.js} +1 -1
  19. package/dist/browser-lazy/chunks/{chunk-QMZ4Y6I7.js → chunk-LNIHDJSF.js} +1 -1
  20. package/dist/browser-lazy/chunks/{chunk-EBPTM2RP.js → chunk-NZRUMODH.js} +1 -1
  21. package/dist/browser-lazy/chunks/{chunk-ANTNEVJC.js → chunk-PXKL3O6H.js} +1 -1
  22. package/dist/browser-lazy/chunks/{chunk-WN7SFUCZ.js → chunk-SUFMSWTX.js} +1 -1
  23. package/dist/browser-lazy/chunks/{chunk-32FWKUUV.js → chunk-UAEZO5VL.js} +1 -1
  24. package/dist/browser-lazy/chunks/{chunk-W6Q4PHPC.js → chunk-X64T74C5.js} +1 -1
  25. package/dist/browser-lazy/chunks/{class-7JRALQIM.js → class-F7R6TJ73.js} +1 -1
  26. package/dist/browser-lazy/chunks/{er-UDCGHKBX.js → er-BDK7CM5L.js} +1 -1
  27. package/dist/browser-lazy/chunks/{flowchart-5FP7RRIK.js → flowchart-KFU6XV7S.js} +1 -1
  28. package/dist/browser-lazy/chunks/{gantt-NTOIC5CW.js → gantt-I64VVDSP.js} +1 -1
  29. package/dist/browser-lazy/chunks/{gitgraph-JYAPXUIJ.js → gitgraph-EDUVJ5IJ.js} +1 -1
  30. package/dist/browser-lazy/chunks/{journey-646EFIB6.js → journey-TLO2RNM3.js} +1 -1
  31. package/dist/browser-lazy/chunks/{mindmap-2SBTQHQO.js → mindmap-OJCNDYPM.js} +1 -1
  32. package/dist/browser-lazy/chunks/{pie-7FDXZ24K.js → pie-HVG6XO7K.js} +1 -1
  33. package/dist/browser-lazy/chunks/{quadrant-72UT4XAW.js → quadrant-U6S2L4MJ.js} +1 -1
  34. package/dist/browser-lazy/chunks/{radar-SU7BO56J.js → radar-ZDLOBTVG.js} +1 -1
  35. package/dist/browser-lazy/chunks/{render-core-Q2JWXDDL.js → render-core-Y2DFNMQG.js} +1 -1
  36. package/dist/browser-lazy/chunks/{sequence-5O5ET264.js → sequence-Z4WFS3VB.js} +1 -1
  37. package/dist/browser-lazy/chunks/{state-IWPLFQ6R.js → state-2HV2YGN3.js} +1 -1
  38. package/dist/browser-lazy/chunks/{timeline-WJWYHH5Y.js → timeline-XM4UFPOC.js} +1 -1
  39. package/dist/browser-lazy/chunks/{xychart-HHQVQA5O.js → xychart-7JDHWTQY.js} +1 -1
  40. package/dist/browser-lazy/index.js +1 -1
  41. package/dist/browser.global.js +5 -5
  42. package/dist/{chunk-NE6JBHSE.js → chunk-GGXCNCNA.js} +39 -44
  43. package/dist/{chunk-YWKCUBQN.js → chunk-IVD4NXNE.js} +2 -2
  44. package/dist/{chunk-IVN6KP3W.js → chunk-JDMRPUAG.js} +2 -2
  45. package/dist/{chunk-R5U67OIW.js → chunk-JWAAW3FH.js} +4 -4
  46. package/dist/{chunk-3D4EHVQ4.js → chunk-LCGBT32P.js} +7 -7
  47. package/dist/{chunk-GX7UT56Q.js → chunk-RWMZRUIC.js} +2 -2
  48. package/dist/{index-BFg_LoZS.d.ts → index-BGA_-6LV.d.ts} +1 -1
  49. package/dist/index.d.ts +1 -1
  50. package/dist/index.js +1 -1
  51. package/dist/mcp-cli-4MLKC3ZH.js +17 -0
  52. package/docs/MCP-DIRECTORY-LISTINGS.md +72 -0
  53. package/docs/MCP-PRIVACY.md +52 -0
  54. package/docs/style-authoring.md +1 -1
  55. package/package.json +12 -1
  56. package/server.json +2 -2
  57. package/skills/agentic-mermaid-diagram-workflow/SKILL.md +64 -1
  58. package/skills/agentic-mermaid-diagram-workflow/references/hosted-mcp.md +110 -0
  59. package/dist/mcp-cli-XGZP6CMW.js +0 -17
@@ -12,7 +12,40 @@ An agent-agnostic typed editing surface for Mermaid. New diagrams can be authore
12
12
  - `agentic-mermaid-mcp` connected → **Code Mode** (`references/code-mode.md`). Multi-step edits in one round-trip.
13
13
  - Can run JS/TS with imports → **library** (`agentic-mermaid/agent`). Same SDK.
14
14
  - Shell only → **CLI** (`references/cli.md`).
15
- - No local install, network only → **hosted MCP** at `https://agentic-mermaid.dev/mcp` (stateless streamable HTTP JSON-RPC; `execute` Code Mode, `describe_sdk` for one family's mutation schema on demand, `render_svg`/`render_ascii`/`render_png`/`verify`/`describe`, and the declarative `mutate` (edit a `source`) / `build` (author from a `family`) tools — prefer `mutate`/`build` for structured edits; 64KB input caps).
15
+ - No local install, network only → **hosted MCP** at `https://agentic-mermaid.dev/mcp` (stateless Streamable HTTP JSON-RPC; `execute`, `describe_sdk`, `render_svg`, `render_ascii`, `render_png`, `verify`, `describe`, `mutate`, and `build` tools — 64 KB input cap). Read `references/hosted-mcp.md` before composing a hosted request. Use the named direct tool and its exact argument object; do not substitute library APIs or local Code Mode for a hosted direct-tool task.
16
+
17
+ For hosted MCP, choose the least-powerful tool that completes the task:
18
+
19
+ | Need | Tool | Required arguments |
20
+ |---|---|---|
21
+ | Structural validity, family, warnings, layout counts | `verify` | `{ source }` |
22
+ | Prose, AX tree, or semantic fact inventory | `describe` | `{ source, format?: 'text' \| 'json' \| 'facts' }` |
23
+ | Edit an existing diagram with known ops | `mutate` | `{ source, ops: [{ kind, ...fields }] }` |
24
+ | Author a new modeled diagram with known ops | `build` | `{ family, ops: [{ kind, ...fields }] }` |
25
+ | Discover one family's exact op fields | `describe_sdk` | `{ family, detail: 'fields' }` |
26
+ | Custom synchronous control flow | `execute` | `{ code, timeoutMs? }` |
27
+
28
+ Use `render_svg`, `render_ascii`, or `render_png` for a requested output; do not route a one-shot render, verify, describe, mutate, or build through `execute`.
29
+ Mutation vocabularies are family-specific and are never interchangeable. In
30
+ particular, a state diagram uses `add_state` and `add_transition`; never reuse
31
+ the flowchart-only `add_node` or `add_edge` kinds for a state diagram. If the
32
+ exact family op is not already known, call `describe_sdk` instead of borrowing
33
+ an op name from another family. State `add_state` accepts `id`, optional
34
+ `label`, `parent`, and `region`; it has no `terminal` field. Model an
35
+ unsuccessful terminal state as an ordinary state reached by the requested
36
+ labeled transition rather than inventing a convenience flag. For a class
37
+ association, use `{ kind: 'add_relation', from, to, relKind: 'association' }`;
38
+ there is no `add_relationship` op or `relation` field.
39
+ The request envelope's `tool` is always one of the bare hosted names above.
40
+ Never invent a provider-qualified name such as `hosted_agentic_mermaid_mcp.*`
41
+ or a diagram-specific tool such as `update_state_diagram`.
42
+ For a hosted task that asks for one final fenced JSON request, use this exact
43
+ response order: (1) finish all explanation as prose or inline code, (2) emit
44
+ the request in the answer's only fenced block, and (3) stop immediately after
45
+ the closing fence. Never print a fenced request before the explanation, even as
46
+ an example or draft, and never repeat it. Before emitting, count exactly one
47
+ fenced block and recheck every op `kind` and field against this skill or
48
+ `describe_sdk`; do not substitute a plausible synonym.
16
49
 
17
50
  ## Capability discovery
18
51
 
@@ -23,6 +56,10 @@ source example; the generated Section A matrix supplies explicit native,
23
56
  source-preserved, diagnosed, and absent states. This skill intentionally does
24
57
  not maintain a second family or operation table.
25
58
 
59
+ On hosted MCP, inspect the connected server's `tools/list` for its tool surface
60
+ and call `describe_sdk({ family, detail: 'fields' })` for mutation fields. There
61
+ is no hosted tool named `capabilities`.
62
+
26
63
  Any diagram with constructs we don't model falls back to an **opaque** body: it still parses, renders, verifies, and round-trips losslessly — it just isn't offered for structured mutation (the narrower returns null). The parser never silently drops anything.
27
64
 
28
65
  State diagrams own a dedicated body: `asState` models states/transitions, `[*]`, composites, stereotypes/history, concurrency regions, notes, bare declarations, and class/inline paint. `asFlowchart` returns null on a state diagram.
@@ -45,6 +82,32 @@ For new diagrams, author Mermaid source directly, then `parseRegisteredMermaid`
45
82
 
46
83
  Do not regenerate or concatenate source to edit an existing structured diagram when a typed op exists. Direct source authoring is fine for new diagrams. Mutation ops use the discriminator field `kind` (not `type`). Edge removal uses ids such as `{ kind: 'remove_edge', id: 'API->DB' }`; verify before serializing.
47
84
 
85
+ For `mutate` or `build`, treat the returned envelope as the commit boundary:
86
+ accept `source` only when both top-level `ok` and `verify.ok` are true, and
87
+ inspect `verify.warnings`. If an op fails, use its `opIndex` and `error`, call
88
+ `describe_sdk` with `detail: 'fields'`, then retry with only the returned
89
+ `kind` and fields. Never guess a hosted op name or fall back to source
90
+ concatenation.
91
+
92
+ When the user asks which embedded verification fields must pass, name the
93
+ response paths exactly: require top-level `ok`, confirm top-level `family`,
94
+ require `verify.ok`, and inspect `verify.warnings`. Do not replace those field
95
+ paths with a paraphrase.
96
+
97
+ In a hosted `mutate` request, `source` is the exact pre-edit input; do not apply
98
+ the requested change to that string yourself. Express every change only in
99
+ `ops`, and include no convenience fields that `describe_sdk` did not advertise.
100
+ For file-backed input, inspect the bytes rather than relying on terminal display:
101
+ preserve line endings and whether the file has a final newline. If the file ends
102
+ in LF, the JSON `source` string must end in `\n` after its last visible line.
103
+ Never trim or normalize the source; compare the JSON-decoded `source` bytes to
104
+ the attachment before emitting the request.
105
+
106
+ If a request such as “make this better” has no concrete quality goal, ask for
107
+ the audience, output medium, and intended improvement before mutating. A
108
+ read-only `verify`, `describe`, or render inspection is safe to offer, but do
109
+ not invent an edit objective.
110
+
48
111
  Minimal existing-flowchart pattern:
49
112
 
50
113
  ```ts
@@ -0,0 +1,110 @@
1
+ # Hosted MCP
2
+
3
+ Use `https://agentic-mermaid.dev/mcp` through an MCP client. It is a stateless,
4
+ tools-only Streamable HTTP server. Each diagram source or Code Mode program is
5
+ sent to the hosted service. Use the local library, CLI, or stdio MCP instead
6
+ for sensitive data, offline work, inputs over 64 KB, arbitrary local file I/O,
7
+ or file/URL PNG artifacts.
8
+
9
+ ## Direct request contract
10
+
11
+ An MCP client selects the tool separately from its arguments. When showing a
12
+ request, name both explicitly:
13
+
14
+ ```json
15
+ {"tool":"verify","arguments":{"source":"flowchart TD\n API --> DB"}}
16
+ ```
17
+
18
+ For raw JSON-RPC, the method remains `tools/call`:
19
+
20
+ ```json
21
+ {
22
+ "jsonrpc": "2.0",
23
+ "id": 1,
24
+ "method": "tools/call",
25
+ "params": {
26
+ "name": "verify",
27
+ "arguments": { "source": "flowchart TD\n API --> DB" }
28
+ }
29
+ }
30
+ ```
31
+
32
+ Do not use `"method":"verify"`, put arguments directly under `params`, or
33
+ show an anonymous argument object without naming the selected tool.
34
+ The envelope's `tool` value is a bare server tool name. Never prefix it with a
35
+ provider or server name and never invent a diagram-specific tool such as
36
+ `update_state_diagram`.
37
+
38
+ If the answer calls for one final fenced JSON request, finish all prose first,
39
+ emit the request in the answer's only fenced block, then stop after its closing
40
+ fence. Never show a fenced request before the explanation, even as an example
41
+ or draft, and never repeat it. As a final preflight, count one fenced block
42
+ total and verify each op name and field against the family schema; a plausible
43
+ synonym is still an invalid call.
44
+
45
+ ## Direct tools
46
+
47
+ - `verify({ source })` returns structural `ok`, detected `family`, `summary`,
48
+ `warnings`, and layout counts. Confirm the family as well as `ok`.
49
+ - `describe({ source, format })` uses `text` for prose, `json` for an AX tree,
50
+ and `facts` for compact deterministic semantic fact lines.
51
+ - `render_svg({ source, options? })`, `render_ascii({ source, useAscii?,
52
+ targetWidth?, options? })`, and `render_png({ source, ...portableOptions,
53
+ options? })` handle one-shot output.
54
+ - `mutate({ source, ops })` edits an existing modeled diagram.
55
+ - `build({ family, ops })` creates a new modeled diagram from an empty family.
56
+ - `describe_sdk({ family, detail: 'fields' })` returns exact version-matched op
57
+ names, fields, enums, defaults, and constraints. Use `detail: 'signatures'`
58
+ only for a compact menu.
59
+ - `execute({ code, timeoutMs? })` runs synchronous JavaScript with the injected
60
+ `mermaid.*` global. Reserve it for custom control flow that a direct tool or
61
+ op list cannot express.
62
+
63
+ There is no hosted `capabilities` tool. Use the MCP client's `tools/list` for
64
+ tool discovery and `describe_sdk` for one family's mutation schema.
65
+
66
+ ## Declarative edit and recovery
67
+
68
+ Before unfamiliar `mutate` or `build` ops, call:
69
+
70
+ ```json
71
+ {"tool":"describe_sdk","arguments":{"family":"class","detail":"fields"}}
72
+ ```
73
+
74
+ Then use exactly the returned `kind` and fields. Ops are ordered,
75
+ all-or-nothing, and use `kind`, never `type`. A successful edit returns
76
+ `{ ok, family, source, verify }`; accept the source only when `ok` and
77
+ `verify.ok` are true, after inspecting `verify.warnings`.
78
+ Op kinds are not portable across families: state diagrams use `add_state` and
79
+ `add_transition`, never the flowchart-only `add_node` or `add_edge` kinds.
80
+ If the answer must identify the commit checks, spell out the exact response
81
+ paths: top-level `ok`, top-level `family`, `verify.ok`, and
82
+ `verify.warnings`. Do not paraphrase away those names.
83
+
84
+ Two common exact-schema patterns are:
85
+
86
+ ```json
87
+ {"tool":"mutate","arguments":{"source":"stateDiagram-v2\n [*] --> Idle\n Idle --> Processing: start\n Processing --> Complete: done","ops":[{"kind":"add_state","id":"Failed"},{"kind":"add_transition","from":"Processing","to":"Failed","label":"fail"}]}}
88
+ ```
89
+
90
+ ```json
91
+ {"tool":"build","arguments":{"family":"class","ops":[{"kind":"add_class","id":"Customer"},{"kind":"add_class","id":"Account"},{"kind":"add_relation","from":"Customer","to":"Account","relKind":"association"}]}}
92
+ ```
93
+
94
+ For `mutate`, copy the original pre-edit source byte-for-byte into `source` and
95
+ put the desired change only in `ops`; do not pre-apply it to the source string.
96
+ For an attached or file-backed source, use a byte-aware read to determine its
97
+ line endings and final-newline state. A terminal LF is part of the source: the
98
+ JSON string must end in `\n` after the final visible line. Terminal output that
99
+ only displays the lines is not sufficient evidence that the file lacks one.
100
+ State `add_state` accepts `id`, optional `label`, `parent`, and `region`—there is
101
+ no `terminal` field. Model a terminal path explicitly with an `add_transition`
102
+ to `[*]` when the requested outcome requires one.
103
+
104
+ For class diagrams the family is `class`, not `classDiagram`; class identity is
105
+ `id`, and an association is `add_relation` with `relKind: "association"`.
106
+
107
+ On failure, read `opIndex` and `error`, refresh that family's field schema with
108
+ `describe_sdk`, and retry only the failed request with corrected documented
109
+ fields. Do not invent an op, switch to source concatenation, or split one
110
+ oversized diagram across hosted calls.
@@ -1,17 +0,0 @@
1
- import {
2
- MCP_CLI_HELP,
3
- MCP_FLAG_SPECS,
4
- parseMcpCliOptions,
5
- runMcpCli
6
- } from "./chunk-NE6JBHSE.js";
7
- import "./chunk-IVN6KP3W.js";
8
- import "./chunk-YWKCUBQN.js";
9
- import "./chunk-GX7UT56Q.js";
10
- import "./chunk-3D4EHVQ4.js";
11
- export {
12
- MCP_CLI_HELP,
13
- MCP_FLAG_SPECS,
14
- parseMcpCliOptions,
15
- runMcpCli
16
- };
17
- //# sourceMappingURL=mcp-cli-XGZP6CMW.js.map