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
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{Ab as K,Bb as X,Na as I,Oa as B,Ra as M,Va as j,Xa as z,rb as H,sb as Y,ta as V,yb as q}from"./chunk-JZOJ4YGS.js";import{I as D,Ld as W,R as v,Ra as x,Wa as L,Za as g,_a as w,nb as G}from"./chunk-OMY6NRQD.js";import{fileURLToPath as Je}from"url";import{tmpdir as Ze}from"os";import{basename as Qe,dirname as le,join as F}from"path";import{existsSync as et,mkdtempSync as tt,rmSync as ye,writeFileSync as rt}from"fs";import{Resvg as nt}from"@resvg/resvg-js";function J(e){if(!e.includes("auto-start-reverse"))return e;const r=L(e);const t=new Set(r.map(n=>g(n,"id")).filter(Boolean));const i=new Map;const s=[];for(const n of r){if(n.name!=="marker"||g(n,"orient")!=="auto-start-reverse")continue;const c=g(n,"id");if(!c||n.selfClosing)continue;const a=e.indexOf("</marker>",n.end);if(a<0)throw new Error(`Unclosed native marker ${c}`);const f=g(n,"viewBox")?.trim().split(/[\s,]+/).map(Number);const m=Number(g(n,"markerWidth")??3);const u=Number(g(n,"markerHeight")??3);const[p,l,O,E]=f??[0,0,m,u];const S=Number(g(n,"refX")??0);const y=Number(g(n,"refY")??0);if(![p,l,O,E,S,y].every(h=>typeof h==="number"&&Number.isFinite(h))){throw new Error(`Native marker ${c} requires numeric coordinates`)}let b=`${c}-native-start`;while(t.has(b))b+="-";t.add(b);i.set(c,b);const A=p+O/2,$=l+E/2;const k={id:x(b),orient:"auto",refX:String(2*A-S),refY:String(2*$-y)};let U=w(e.slice(n.start,n.end),h=>k[h.name]);for(const h of["refX","refY"]){if(!n.attributes.some(Re=>Re.name===h))U=U.replace(/>$/,` ${h}="${k[h]}">`)}s.push({at:a+"</marker>".length,content:`
|
|
2
|
+
${U}<g transform="rotate(180 ${A} ${$})">${e.slice(n.end,a)}</g></marker>`})}let o=e;for(const n of s.reverse())o=o.slice(0,n.at)+n.content+o.slice(n.at);return w(o,(n,c)=>{if(c.name==="marker"&&n.name==="orient"&&n.value==="auto-start-reverse")return"auto";if(n.name!=="marker-start")return void 0;const a=/^url\(#([^)]*)\)$/.exec(g(c,"marker-start")??"")?.[1];const f=a?i.get(a):void 0;return f?`url(#${x(f)})`:void 0})}import{readdirSync as _e,readFileSync as Fe,statSync as Te}from"fs";import{join as Ae}from"path";import{decodeXML as he}from"entities";var Ee=1668112752;var Se=1953784678;var Pe=1330926671;var be=1953658213;function Oe(e){const r=new DataView(e.buffer,e.byteOffset,e.byteLength);try{if(r.getUint32(0)===Se){const i=[];for(let s=0;s<r.getUint32(8);s++)i.push(Z(r,r.getUint32(12+s*4)));return i.filter(s=>s.length>0)}const t=Z(r,0);return t.length>0?[t]:[]}catch{return[]}}function Z(e,r){const t=e.getUint32(r);if(t!==65536&&t!==Pe&&t!==be)return[];const i=e.getUint16(r+4);for(let s=0;s<i;s++){const o=r+12+s*16;if(e.getUint32(o)===Ee)return Ie(e,e.getUint32(o+8))}return[]}function Ie(e,r){const t=[];const i=e.getUint16(r+2);for(let s=0;s<i;s++){const o=r+4+s*8;const n=e.getUint16(o);const c=e.getUint16(o+2);if(!(n===0||n===3&&(c===1||c===10)))continue;const a=r+e.getUint32(o+4);const f=e.getUint16(a);if(f===4)t.push(Ue(e,a));else if(f===12)t.push(xe(e,a));else if(f===6)t.push(we(e,a));else if(f===0)t.push(Me(e,a))}return t}function Ue(e,r){const t=e.getUint16(r+6)/2;const i=r+14;const s=i+t*2+2;const o=s+t*2;const n=o+t*2;return{has(c){if(c>65535)return false;let a=0,f=t-1;while(a<f){const l=a+f>>1;if(e.getUint16(i+l*2)<c)a=l+1;else f=l}if(e.getUint16(s+a*2)>c||c===65535)return false;const m=e.getUint16(n+a*2);if(m===0)return(c+e.getInt16(o+a*2)&65535)!==0;const u=n+a*2+m+(c-e.getUint16(s+a*2))*2;if(u+2>e.byteLength)return false;const p=e.getUint16(u);return p!==0&&(p+e.getInt16(o+a*2)&65535)!==0}}}function xe(e,r){const t=e.getUint32(r+12);const i=r+16;return{has(s){let o=0,n=t-1;while(o<=n){const c=o+n>>1;const a=i+c*12;if(s<e.getUint32(a))n=c-1;else if(s>e.getUint32(a+4))o=c+1;else return e.getUint32(a+8)+s-e.getUint32(a)!==0}return false}}}function we(e,r){const t=e.getUint16(r+6);const i=e.getUint16(r+8);return{has:s=>s>=t&&s<t+i&&e.getUint16(r+10+(s-t)*2)!==0}}function Me(e,r){return{has:t=>t<256&&e.getUint8(r+6+t)!==0}}function Ne(e){let r="";for(const t of e.matchAll(/<text\b[^>]*>([\s\S]*?)<\/text>/g))r+=t[1].replace(/<[^>]*>/g,"");return he(r)}function Ce(e){return e<=32||e===127||e>=8203&&e<=8207||e===8232||e===8233||e>=65024&&e<=65039||e===65279}function Q(e){if(e>=11904&&e<=40959||e>=44032&&e<=55295||e>=63744&&e<=64255||e>=131072&&e<=262143)return"CJK";if(e>=9728&&e<=10175||e>=126976&&e<=129791)return"emoji";if(e>=1424&&e<=1535)return"Hebrew";if(e>=1536&&e<=1919)return"Arabic";if(e>=2304&&e<=2431)return"Devanagari";return"other"}function ee(e,r){const t=r.flatMap(Oe);const i=new Map;for(const s of D(Ne(e))){const o=[...s].map(a=>a.codePointAt(0)).filter(a=>!Ce(a));if(o.length===0)continue;const n=t.some(a=>o.every(f=>a.some(m=>m.has(f))));const c=s.includes("\u200D")||/\p{Mark}/u.test(s);if(n&&!c)continue;for(const a of o){const f=i.get(Q(a))??new Set;f.add(a);i.set(Q(a),f)}}return[...i].sort(([s],[o])=>s<o?-1:s>o?1:0).map(([s,o])=>({script:s,chars:[...o].sort((n,c)=>n-c).map(n=>String.fromCodePoint(n))}))}var $e=/\.(ttf|otf|ttc|otc)$/i;function te(e,r=4){if(r<0)return[];let t;try{t=_e(e).sort()}catch{return[]}const i=[];for(const s of t){const o=Ae(e,s);try{const n=Te(o);if(n.isDirectory())i.push(...te(o,r-1));else if($e.test(s))i.push(o)}catch{}}return i}function ke(e){const r=[];for(const t of e){for(const i of te(t)){try{r.push(new Uint8Array(Fe(i)))}catch{}}}return r}function re(e,r,t){return ee(e,[...t,...ke(r)])}function ne(e,r={}){return e.map(({script:t,chars:i})=>{const s=i.slice(0,5).join(" ");const o=r.systemFontsMayCover?" They are absent from bundled/caller-provided fonts; an installed system font may cover them, so final shaping is machine-dependent.":" They may draw as tofu or fail to shape as one grapheme.";return{code:"PNG_FONT_COVERAGE",script:t,chars:[...i],message:`no known loaded face covers ${i.length} ${t} character${i.length===1?"":"s"} (${s}) in one grapheme cluster.${o} Supply fontDirs (CLI: --font-dirs <dir>) with a face that covers the cluster.`}})}import{createHash as De}from"crypto";import{closeSync as N,constants as oe,fstatSync as C,lstatSync as se,openSync as ve,readSync as Le,realpathSync as ie}from"fs";import{isAbsolute as ae,join as Ge,relative as ce,sep as _}from"path";var d=class extends Error{code;resourceId;constructor(r,t,i){super(`${r}: ${i}`);this.name="ResourceResolutionError";this.code=r;this.resourceId=t}};function fe(e){return typeof e==="object"&&e!==null&&"code"in e?String(e.code):void 0}function We(e){return De("sha256").update(e).digest("hex")}function Ve(e,r){if(e==="linux")return`/proc/self/fd/${r}`;if(e==="darwin")return`/dev/fd/${r}`;return void 0}var P=class{#e;#t;#r;#n;#o;constructor(r,t,i={}){let s;try{s=I(t)}catch(n){const c=n instanceof Error?n.message.replace(/^INVALID_RESOURCE_MANIFEST:\s*/,""):String(n);throw new d("INVALID_RESOURCE_MANIFEST","resource-manifest",c)}const o=i.maxResourceBytes??16*1024*1024;if(!Number.isSafeInteger(o)||o<=0){throw new d("INVALID_RESOURCE_MANIFEST","resource-manifest","maxResourceBytes must be a positive safe integer")}try{this.#e=ie(r)}catch{throw new d("RESOURCE_MISSING","resource-manifest",`package root does not exist: ${r}`)}this.#t=s;this.#r=o;this.#n=Object.freeze({...i.mediaTypes??B});this.#o=new Map(this.#t.resources.map(n=>[n.identity.id,n]))}list(){return this.#t.resources}#s(r,t,i){const s=t.split("/");let o=this.#e;for(const c of s){o=Ge(o,c);let a;try{a=se(o)}catch(f){if(fe(f)==="ENOENT"){throw new d(i,r.identity.id,`declared path is missing: ${t}`)}throw f}if(a.isSymbolicLink()){throw new d("RESOURCE_SYMLINK_REJECTED",r.identity.id,`symlink component is forbidden: ${t}`)}}const n=ce(this.#e,o);if(n===".."||n.startsWith(`..${_}`)||ae(n)){throw new d("RESOURCE_PATH_ESCAPE",r.identity.id,`path escapes package root: ${t}`)}return o}#i(r,t,i){const s=this.#s(r,t,i);let o;try{o=ve(s,oe.O_RDONLY|oe.O_NOFOLLOW)}catch(n){const c=fe(n);if(c==="ENOENT")throw new d(i,r.identity.id,`declared path is missing: ${t}`);if(c==="ELOOP")throw new d("RESOURCE_SYMLINK_REJECTED",r.identity.id,`symlink component is forbidden: ${t}`);throw n}try{const n=C(o);if(!n.isFile()){throw new d("RESOURCE_NOT_REGULAR",r.identity.id,`resource is not a regular file: ${t}`)}const c=Ve(process.platform,o);if(c){const m=ie(c);if(m!==c&&!m.startsWith(`${c}${_}`)){const u=ce(this.#e,m);if(u===".."||u.startsWith(`..${_}`)||ae(u)){throw new d("RESOURCE_PATH_ESCAPE",r.identity.id,`opened file escapes package root: ${t}`)}}}const a=this.#s(r,t,i);const f=se(a);if(!f.isFile()){throw new d("RESOURCE_NOT_REGULAR",r.identity.id,`resource is not a regular file: ${t}`)}if(n.dev!==f.dev||n.ino!==f.ino){throw new d("RESOURCE_PATH_ESCAPE",r.identity.id,`opened file identity no longer matches the rooted path: ${t}`)}return o}catch(n){N(o);throw n}}resolve(r){const t=this.#o.get(r);if(!t)throw new d("UNKNOWN_RESOURCE",r,`resource is not installed: ${r}`);if(t.bytes>this.#r){throw new d("RESOURCE_SIZE_LIMIT",r,`${t.bytes} exceeds the ${this.#r}-byte host limit`)}const i=this.#i(t,t.license.noticePath,"RESOURCE_LICENSE_NOTICE_MISSING");N(i);const s=this.#i(t,t.path,"RESOURCE_MISSING");let o;try{const f=C(s);if(f.size!==t.bytes){throw new d("RESOURCE_SIZE_MISMATCH",r,`declared ${t.bytes} bytes but found ${f.size}`)}const m=new Uint8Array(t.bytes+1);let u=0;while(u<m.byteLength){const l=Le(s,m,u,m.byteLength-u,null);if(l===0)break;u+=l}const p=C(s);if(u!==t.bytes||p.size!==t.bytes){throw new d("RESOURCE_SIZE_MISMATCH",r,`declared ${t.bytes} bytes but securely read ${u}`)}o=m.slice(0,u)}finally{N(s)}const n=this.#n[t.mediaType];if(!n||!n(o)){throw new d("RESOURCE_MEDIA_TYPE_MISMATCH",r,`resource bytes do not match ${t.mediaType}`)}const c=We(o);if(c!==t.sha256){throw new d("RESOURCE_DIGEST_MISMATCH",r,`expected ${t.sha256}, received ${c}`)}const a=o.slice();return Object.freeze({entry:t,readBytes:()=>a.slice()})}verifyInstalled(){const r=[];const t=[];for(const i of this.#t.resources){try{r.push(this.resolve(i.identity.id))}catch(s){if(!i.required&&s instanceof d&&s.code==="RESOURCE_MISSING"){t.push(Object.freeze({code:"OPTIONAL_RESOURCE_MISSING",resourceId:i.identity.id,message:s.message}));continue}throw s}}return Object.freeze({resources:Object.freeze(r),diagnostics:Object.freeze(t)})}};import{tmpdir as Be}from"os";import{dirname as je,join as de}from"path";import{mkdirSync as ze,mkdtempSync as He,readFileSync as Ye,rmSync as qe,writeFileSync as Ke}from"fs";var ue;function Xe(e,r){const t=I(e);const i=new Map;for(const o of t.resources){i.set(o.path,{resourceId:o.identity.id,missingCode:"RESOURCE_MISSING"});if(!i.has(o.license.noticePath)){i.set(o.license.noticePath,{resourceId:o.identity.id,missingCode:"RESOURCE_LICENSE_NOTICE_MISSING"})}}const s=He(de(Be(),"agentic-mermaid-embedded-resources-"));try{const o=new Set;for(const n of r){const c=i.get(n.manifestPath);if(!c){throw new d("UNKNOWN_RESOURCE",n.manifestPath,`embedded path is not declared by the font resource manifest: ${n.manifestPath}`)}if(o.has(n.manifestPath)){throw new d("INVALID_RESOURCE_MANIFEST",c.resourceId,`duplicate embedded path: ${n.manifestPath}`)}let a;try{a=Ye(n.embeddedPath)}catch{throw new d(c.missingCode,c.resourceId,`embedded source is unavailable for declared path: ${n.manifestPath}`)}const f=de(s,n.manifestPath);ze(je(f),{recursive:true,mode:448});Ke(f,a,{flag:"wx",mode:256});o.add(n.manifestPath)}return new P(s,t).verifyInstalled()}finally{try{qe(s,{recursive:true,force:true})}catch{}}}function me(e){return ue?Xe(e,ue):void 0}var R;var pe=false;function ge(e){const r=tt(F(Ze(),"agentic-mermaid-fonts-"));try{const t=e.map(s=>s.readBytes());const i=t.map((s,o)=>{const n=F(r,`${o}-${Qe(e[o].entry.path)}`);rt(n,s,{flag:"wx",mode:256});return n});return Object.freeze({snapshotDirectory:r,buffers:Object.freeze(t),files:Object.freeze(i)})}catch(t){try{ye(r,{recursive:true,force:true})}catch{}throw t}}function ot(){if(R)return R;const e=typeof import.meta.url==="string"?Je(import.meta.url):__filename;let r=le(e);for(let t=0;t<6;t++){const i=F(r,"assets","fonts");if(et(i)){const o=new P(r,M).verifyInstalled();R=ge(o.resources);break}const s=le(r);if(s===r)break;r=s}if(!R){const t=me(M);if(t)R=ge(t.resources)}if(!R)throw new Error("RESOURCE_MISSING: required bundled font manifest could not be located");if(!pe){pe=true;process.once("exit",()=>{try{if(R)ye(R.snapshotDirectory,{recursive:true,force:true})}catch{}})}return R}function Ht(e,r={}){return st(e,r).png}function st(e,r={}){return T(e,r,{})}function Yt(e={}){const r=W(e.backendPolicy);const t=v(e.textMeasurement);const i=Object.freeze({...r?{backendPolicy:r}:{},...t?{textMeasurement:t}:{}});return Object.freeze({renderMermaidPNG(s,o={}){return T(s,o,i).png},renderMermaidPNGWithReceipt(s,o={}){return T(s,o,i)}})}function T(e,r,t){const i=V(e);const s=i.source;const o=r.onWarning;if(o!==void 0&&typeof o!=="function"){throw new TypeError("PNG onWarning must be a function")}const n=H(r);const c=Y(r);const a=X(s,c,n,{backendPolicy:t.backendPolicy,textMeasurement:t.textMeasurement,expectedFamilyId:i.expectedFamilyId});const f=a.outputPolicy;const m=K(J(G(a.svg)),a.rasterDimensions);const u=ot();const p=o??(y=>process.stderr.write(`agentic-mermaid renderMermaidPNG: warning ${y.code}: ${y.message}
|
|
3
|
+
`));for(const y of ne(re(m,f.fonts.callerDirectories,u.buffers),{systemFontsMayCover:f.fonts.loadSystemFonts}))p(y);for(const y of a.legibilityWarnings)p(y);const l={background:a.rasterBackground,fitTo:{mode:"zoom",value:1},font:{loadSystemFonts:f.fonts.loadSystemFonts,fontFiles:[...u.files],fontDirs:[...f.fonts.callerDirectories],defaultFontFamily:f.fonts.defaultFamily}};const O=new nt(m,l);const E=z(O.render().asPng());const S=j(E);if(S.width!==a.rasterDimensions.width||S.height!==a.rasterDimensions.height){throw new Error(`native PNG rasterizer returned ${S.width}\xD7${S.height}; expected ${a.rasterDimensions.width}\xD7${a.rasterDimensions.height}`)}return{png:new Uint8Array(E.buffer,E.byteOffset,E.byteLength),receipt:a.receipt,runtime:q(f.fonts)}}export{Ht as a,st as b,Yt as c};
|
|
4
|
+
//# sourceMappingURL=chunk-GVCHLSHH.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import{a as m}from"./chunk-7PPW2BMO.js";var h=`agentic-mermaid-mcp [--transport stdio|http] [--host 127.0.0.1] [--port 3000]
|
|
2
|
+
|
|
3
|
+
Options:
|
|
4
|
+
--transport stdio|http Transport to run (default stdio).
|
|
5
|
+
--host <host> HTTP/SSE bind host (default 127.0.0.1).
|
|
6
|
+
--port <port> HTTP/SSE bind port (default 3000, 0 = ephemeral).
|
|
7
|
+
--artifact-dir <dir> Managed artifact directory for file/url outputs.
|
|
8
|
+
--public-url <url> Public artifact prefix; its origin is allowed by HTTP/SSE.
|
|
9
|
+
--max-artifact-bytes <n> Maximum bytes in one artifact (default 20MiB).
|
|
10
|
+
--max-artifact-total-bytes <n> Aggregate managed artifact bytes (default 200MiB).
|
|
11
|
+
--max-artifacts <n> Maximum managed artifact count (default 1000).
|
|
12
|
+
--artifact-ttl-ms <n> Artifact cleanup TTL (default 1h).
|
|
13
|
+
--max-rpc-body-bytes <n> Max HTTP JSON-RPC body size (default 1MiB).
|
|
14
|
+
--auth-token <token> Bearer token required for every non-health HTTP route.
|
|
15
|
+
--max-sandbox-timeout-ms <n> Max execute timeout (default 30000).
|
|
16
|
+
--help Show this help.
|
|
17
|
+
`;var f=Object.freeze({help:{kind:"boolean",applicability:"both"},transport:{kind:"string",applicability:"both"},host:{kind:"string",applicability:"http"},port:{kind:"integer",applicability:"http",min:0,max:65535},"artifact-dir":{kind:"string",applicability:"both"},"public-url":{kind:"string",applicability:"http"},"max-artifact-bytes":{kind:"integer",applicability:"both",min:1},"max-artifact-total-bytes":{kind:"integer",applicability:"both",min:1},"max-artifacts":{kind:"integer",applicability:"both",min:1},"artifact-ttl-ms":{kind:"integer",applicability:"both",min:1},"max-rpc-body-bytes":{kind:"integer",applicability:"http",min:1},"auth-token":{kind:"string",applicability:"http"},"max-sandbox-timeout-ms":{kind:"integer",applicability:"both",min:1}});function y(n){const t={};for(let r=0;r<n.length;r++){let a=n[r];if(a==="-h")a="--help";if(!a.startsWith("--"))throw new Error(`unexpected positional argument: ${a}`);const e=a.indexOf("=");const i=a.slice(2,e<0?void 0:e);const d=f[i];if(!d)throw new Error(`unknown option: --${i}`);if(Object.hasOwn(t,i))throw new Error(`duplicate flag: --${i}`);const u=e<0?void 0:a.slice(e+1);if(d.kind==="boolean"){if(u!==void 0)throw new Error(`--${i} does not accept a value`);t[i]=true;continue}const c=u??n[++r];if(c===void 0||c.length===0||c.startsWith("-")){throw new Error(`--${i} requires a value`)}t[i]=c}return Object.freeze(t)}function l(n,t){const r=n[t];return typeof r==="string"?r:void 0}function p(n,t){const r=l(n,t);if(r===void 0)return void 0;const a=f[t];if(a.kind!=="integer")throw new Error(`internal MCP flag authority mismatch for --${t}`);const e=a;const i=Number(r);if(!Number.isSafeInteger(i)||i<e.min||e.max!==void 0&&i>e.max){throw new Error(`--${t} must be an integer${e.max===void 0?` >= ${e.min}`:` between ${e.min} and ${e.max}`}`)}return i}function b(n){const t=y(n);const r=l(t,"transport");if(r!==void 0&&r!=="stdio"&&r!=="http"){throw new Error(`unknown transport: ${r}`)}const a=r==="http"?"http":"stdio";if(a==="stdio"){const e=Object.keys(t).filter(i=>f[i]?.applicability==="http");if(e.length>0)throw new Error(`${e.map(i=>`--${i}`).join(", ")} ${e.length===1?"is":"are"} valid only with HTTP transport`)}return{transport:a,httpOptions:{host:l(t,"host"),port:p(t,"port"),artifactDir:l(t,"artifact-dir"),publicUrl:l(t,"public-url"),maxArtifactBytes:p(t,"max-artifact-bytes"),maxArtifactTotalBytes:p(t,"max-artifact-total-bytes"),maxArtifacts:p(t,"max-artifacts"),artifactTtlMs:p(t,"artifact-ttl-ms"),maxRpcBodyBytes:p(t,"max-rpc-body-bytes"),authToken:l(t,"auth-token"),maxSandboxTimeoutMs:p(t,"max-sandbox-timeout-ms")}}}async function x(n=process.argv.slice(2),t={}){const r=t.stdout??process.stdout;const a=t.stderr??process.stderr;const e=o=>{a.write(`agentic-mermaid-mcp: ${o instanceof Error?o.message:String(o)}
|
|
18
|
+
`);return 1};let i;try{if(n.includes("--help")||n.includes("-h")){r.write(h);return 0}const o=m();if(o)throw new Error(o);i=b(n)}catch(o){return e(o)}const{runHttp:d,runStdio:u}=await import("./server-5NEOHOFS.js");const{transport:c,httpOptions:s}=i;try{if(c==="http"){await d(s);return 0}await u({artifactDir:s.artifactDir,maxArtifactBytes:s.maxArtifactBytes,maxArtifactTotalBytes:s.maxArtifactTotalBytes,maxArtifacts:s.maxArtifacts,artifactTtlMs:s.artifactTtlMs,maxSandboxTimeoutMs:s.maxSandboxTimeoutMs});return 0}catch(o){return e(o)}}export{h as a,f as b,b as c,x as d};
|
|
19
|
+
//# sourceMappingURL=chunk-H3NCS2XZ.js.map
|