{"_id":"@dmiyding/openclaw-diagram-renderer","_rev":"6-370ff24c831f958250bfceb9d593e9b5","name":"@dmiyding/openclaw-diagram-renderer","dist-tags":{"latest":"0.1.6"},"versions":{"0.1.0":{"name":"@dmiyding/openclaw-diagram-renderer","version":"0.1.0","keywords":["openclaw","mermaid","diagram","plugin","agent"],"license":"MIT","_id":"@dmiyding/openclaw-diagram-renderer@0.1.0","maintainers":[{"name":"dmiyding","email":"dingmingyang123@gmail.com"}],"bin":{"agent-diagram":"dist/cli.js"},"dist":{"shasum":"225d30d5e71a1fae965bc935622d7c2e2f3437dc","tarball":"https://registry.npmjs.org/@dmiyding/openclaw-diagram-renderer/-/openclaw-diagram-renderer-0.1.0.tgz","fileCount":52,"integrity":"sha512-8sItI7gqPxY02thhbEf7QAto3Le7drRc2u04GFFUeTeLriND3YfSYcsADvjPqQyFY87ujENHCWNbQVvqgAckwg==","signatures":[{"sig":"MEUCICD4+gFGRuImQNAvcM/00KrXI/eTvBCFg6gjozHdcBUPAiEApWoCNFxDs0iWufYn0CtULjKAURQZxRvNVlQGMrXVtbk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":125928},"type":"module","exports":{".":"./dist/index.js"},"private":false,"scripts":{"build":"npm run clean && tsc -p tsconfig.json","check":"tsc -p tsconfig.json --noEmit","clean":"rm -rf dist"},"_npmUser":{"name":"dmiyding","email":"dingmingyang123@gmail.com"},"openclaw":{"extensions":["./index.ts"]},"_npmVersion":"11.4.2","description":"Agent-native diagram rendering pipeline with Mermaid-first support","directories":{},"_nodeVersion":"24.3.0","dependencies":{"mermaid":"^11.12.0","playwright-core":"^1.58.2"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.9.3","@types/node":"^24.6.0"},"peerDependencies":{"openclaw":">=2026.3.11"},"peerDependenciesMeta":{"openclaw":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openclaw-diagram-renderer_0.1.0_1773976192629_0.7548869711991422","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@dmiyding/openclaw-diagram-renderer","version":"0.1.1","keywords":["openclaw","mermaid","diagram","plugin","agent"],"license":"MIT","_id":"@dmiyding/openclaw-diagram-renderer@0.1.1","maintainers":[{"name":"dmiyding","email":"dingmingyang123@gmail.com"}],"bin":{"agent-diagram":"dist/cli.js"},"dist":{"shasum":"3715b707724b976f355fb795e445ce01a02570f4","tarball":"https://registry.npmjs.org/@dmiyding/openclaw-diagram-renderer/-/openclaw-diagram-renderer-0.1.1.tgz","fileCount":56,"integrity":"sha512-UxCZI63wOqR6KYkgrReSSWz5TUSjIwwQFljU5Cu9kequg8HrP9cGWkZpwY/qUaWxKNY9tDNbDuNo1Br3DYmpNw==","signatures":[{"sig":"MEUCIGWPWtvydAZvCi2wt19/++HdbXBZhMAV5GSTV1aTaVhvAiEAr9YkeMBaMLo/SwrgQz1AB/LzdE/iZH5d2kJ2zYF74UA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":128026},"type":"module","exports":{".":"./dist/index.js"},"private":false,"scripts":{"build":"npm run clean && tsc -p tsconfig.json","check":"tsc -p tsconfig.json --noEmit && node ./scripts/validate-plugin-package.mjs","clean":"rm -rf dist"},"_npmUser":{"name":"dmiyding","email":"dingmingyang123@gmail.com"},"openclaw":{"id":"openclaw-diagram-renderer","extensions":["./index.ts"]},"_npmVersion":"11.4.2","description":"Agent-native diagram rendering pipeline with Mermaid-first support","directories":{},"_nodeVersion":"24.3.0","dependencies":{"mermaid":"^11.12.0","playwright-core":"^1.58.2"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.9.3","@types/node":"^24.6.0"},"peerDependencies":{"openclaw":">=2026.3.11"},"peerDependenciesMeta":{"openclaw":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openclaw-diagram-renderer_0.1.1_1773979888295_0.8474174335749503","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@dmiyding/openclaw-diagram-renderer","version":"0.1.2","keywords":["openclaw","mermaid","diagram","plugin","agent"],"license":"MIT","_id":"@dmiyding/openclaw-diagram-renderer@0.1.2","maintainers":[{"name":"dmiyding","email":"dingmingyang123@gmail.com"}],"bin":{"agent-diagram":"dist/cli.js"},"dist":{"shasum":"1a8f7de624a708f469f9ba8cdd37a81b782b899a","tarball":"https://registry.npmjs.org/@dmiyding/openclaw-diagram-renderer/-/openclaw-diagram-renderer-0.1.2.tgz","fileCount":59,"integrity":"sha512-0aVIP9d8W5Ckbw1nAwfQoz37mIhiaMpB/pfaZfEWDNjsuadX2I0o5HiAqjTPQlGN4aRTzPGCY6IsiQJ9PemqqQ==","signatures":[{"sig":"MEUCICXdV/EXHsQvjHnqEu5BUO0RVKONxpLK+5UQGX1aMA0ZAiEA6ElrCU3u4epEW55B6pY8OTFskwX7P0k7KbMqD7ynde8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":145924},"type":"module","exports":{".":"./dist/index.js"},"private":false,"scripts":{"build":"npm run clean && tsc -p tsconfig.json","check":"tsc -p tsconfig.json --noEmit && tsc -p tsconfig.plugin.json --noEmit && node ./scripts/validate-plugin-package.mjs && node ./scripts/validate-plugin-entry.mjs","clean":"rm -rf dist","smoke":"npm run build && node ./scripts/smoke.mjs"},"_npmUser":{"name":"dmiyding","email":"dingmingyang123@gmail.com"},"openclaw":{"id":"openclaw-diagram-renderer","extensions":["./index.ts"]},"_npmVersion":"11.4.2","description":"Agent-native diagram rendering pipeline with Mermaid-first support","directories":{},"_nodeVersion":"24.3.0","dependencies":{"mermaid":"^11.12.0","playwright-core":"^1.58.2"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.9.3","@types/node":"^24.6.0"},"peerDependencies":{"openclaw":">=2026.3.11"},"peerDependenciesMeta":{"openclaw":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openclaw-diagram-renderer_0.1.2_1773981525421_0.3698876850932524","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@dmiyding/openclaw-diagram-renderer","version":"0.1.3","keywords":["openclaw","mermaid","diagram","plugin","agent"],"license":"MIT","_id":"@dmiyding/openclaw-diagram-renderer@0.1.3","maintainers":[{"name":"dmiyding","email":"dingmingyang123@gmail.com"}],"bin":{"agent-diagram":"dist/cli.js"},"dist":{"shasum":"cea713f7b62fcb47a5f21fa711b00fe775962ab4","tarball":"https://registry.npmjs.org/@dmiyding/openclaw-diagram-renderer/-/openclaw-diagram-renderer-0.1.3.tgz","fileCount":62,"integrity":"sha512-SYBcqm/42rnht4uqBTjRLojSSHMQTY2gE03cS54pMyrihWm1IgESBKaXJPBGzXR6Pf4r1HokXSL0RIjEkQm3uA==","signatures":[{"sig":"MEQCIH2ckaI0Js8HfCVNWLZEFrEqU2aP1VEiZq1DUlqYJ+3XAiBTgjAo7gWmT2eFha/Eb6bPGt1t4aJc/iP8dbjbHDSZEw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":181749},"type":"module","exports":{".":"./dist/index.js"},"private":false,"scripts":{"build":"npm run clean && tsc -p tsconfig.json","check":"tsc -p tsconfig.json --noEmit && tsc -p tsconfig.plugin.json --noEmit && node ./scripts/validate-plugin-package.mjs && node ./scripts/validate-plugin-entry.mjs","clean":"rm -rf dist","smoke":"npm run build && node ./scripts/smoke.mjs"},"_npmUser":{"name":"dmiyding","email":"dingmingyang123@gmail.com"},"openclaw":{"id":"openclaw-diagram-renderer","extensions":["./index.ts"]},"_npmVersion":"11.4.2","description":"Agent-native diagram rendering pipeline with Mermaid-first support","directories":{},"_nodeVersion":"24.3.0","dependencies":{"mermaid":"^11.12.0","playwright-core":"^1.58.2"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.9.3","@types/node":"^24.6.0"},"peerDependencies":{"openclaw":">=2026.3.11"},"peerDependenciesMeta":{"openclaw":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openclaw-diagram-renderer_0.1.3_1773986120771_0.24151992534512678","host":"s3://npm-registry-packages-npm-production"}},"0.1.4":{"name":"@dmiyding/openclaw-diagram-renderer","version":"0.1.4","keywords":["openclaw","mermaid","diagram","plugin","agent"],"license":"MIT","_id":"@dmiyding/openclaw-diagram-renderer@0.1.4","maintainers":[{"name":"dmiyding","email":"dingmingyang123@gmail.com"}],"bin":{"agent-diagram":"dist/cli.js"},"dist":{"shasum":"c9a44c41abec09564cacd7a41f9e8502a5bd92fc","tarball":"https://registry.npmjs.org/@dmiyding/openclaw-diagram-renderer/-/openclaw-diagram-renderer-0.1.4.tgz","fileCount":71,"integrity":"sha512-R85RnIqgMq2vqZ8H8iotjJ3Oa701iBMbD4GdR+PkKhdSzQvluGKxFnJsOGH5GJmkdrEmUmAbKgqwT7+yJM+/OA==","signatures":[{"sig":"MEUCIQCw4ejhViVy9G9dqB6DZaN1043a6gLRnfPF9a0MVP3eeAIgCaeJRaIt+sdem1AjxMUG9jT4yR/FOZ/5B0TXBB2hnZA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":214120},"type":"module","exports":{".":"./dist/index.js"},"private":false,"scripts":{"build":"npm run clean && tsc -p tsconfig.json && node ./scripts/sync-openclaw-manifest-config-schema.mjs","check":"npm run build && tsc -p tsconfig.plugin.json --noEmit && node ./scripts/validate-plugin-package.mjs && node ./scripts/validate-plugin-entry.mjs","clean":"rm -rf dist","smoke":"npm run build && node ./scripts/smoke.mjs","test:follow-up":"npm run build && node ./scripts/verify-follow-up-media-roots.mjs && node ./scripts/verify-follow-up-channel-send.mjs"},"_npmUser":{"name":"dmiyding","email":"dingmingyang123@gmail.com"},"openclaw":{"id":"openclaw-diagram-renderer","extensions":["./index.ts"]},"_npmVersion":"11.4.2","description":"Agent-native diagram rendering pipeline with Mermaid-first support","directories":{},"_nodeVersion":"24.3.0","dependencies":{"zod":"^3.25.76","mermaid":"^11.12.0","playwright-core":"^1.58.2","@modelcontextprotocol/sdk":"^1.27.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.9.3","@types/node":"^24.6.0"},"peerDependencies":{"openclaw":">=2026.3.11"},"peerDependenciesMeta":{"openclaw":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openclaw-diagram-renderer_0.1.4_1773994765799_0.008286371990231967","host":"s3://npm-registry-packages-npm-production"}},"0.1.6":{"name":"@dmiyding/openclaw-diagram-renderer","version":"0.1.6","private":false,"type":"module","bin":{"agent-diagram":"dist/cli.js"},"description":"Agent-native diagram rendering pipeline with Mermaid-first support","license":"MIT","keywords":["openclaw","mermaid","diagram","plugin","agent"],"exports":{".":"./dist/index.js"},"peerDependencies":{"openclaw":">=2026.3.11"},"peerDependenciesMeta":{"openclaw":{"optional":true}},"openclaw":{"id":"openclaw-diagram-renderer","extensions":["./index.ts"]},"publishConfig":{"access":"public"},"scripts":{"clean":"rm -rf dist","build":"npm run clean && tsc -p tsconfig.json && node ./scripts/sync-openclaw-manifest-config-schema.mjs","check":"npm run build && tsc -p tsconfig.plugin.json --noEmit && node ./scripts/validate-plugin-package.mjs && node ./scripts/validate-plugin-entry.mjs","diagnose":"npm run build && node ./scripts/openclaw-plugin-self-check.mjs","smoke":"npm run build && node ./scripts/smoke.mjs","test:follow-up":"npm run build && node ./scripts/verify-follow-up-media-roots.mjs && node ./scripts/verify-follow-up-channel-send.mjs"},"dependencies":{"@modelcontextprotocol/sdk":"^1.27.1","mermaid":"^11.12.0","playwright-core":"^1.58.2","zod":"^3.25.76"},"devDependencies":{"@types/node":"^24.6.0","typescript":"^5.9.3"},"_id":"@dmiyding/openclaw-diagram-renderer@0.1.6","_nodeVersion":"24.3.0","_npmVersion":"11.4.2","dist":{"integrity":"sha512-Mf/O7hIUHleZeaB0/h8sB1ryCgYEX0on4v4ZDoVgbmQoDaZiaAPtqi9feCMQ/o/TFAOt9BYwBjaxH/ZyQoN7QQ==","shasum":"6547f3b3c497156df91457f83611da7937fbd978","tarball":"https://registry.npmjs.org/@dmiyding/openclaw-diagram-renderer/-/openclaw-diagram-renderer-0.1.6.tgz","fileCount":71,"unpackedSize":236412,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDyyT1+Cb2K+qfBQMfcdlkq8MnQwuxOqnVBn+/2L6PEuQIgVzHz0Gm/boAX8X8cM5L8GZvsW2UgIJnNDuqK0F9MJOw="}]},"_npmUser":{"name":"dmiyding","email":"dingmingyang123@gmail.com"},"directories":{},"maintainers":[{"name":"dmiyding","email":"dingmingyang123@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/openclaw-diagram-renderer_0.1.6_1773998824786_0.6576219612581491"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-20T03:09:52.541Z","modified":"2026-03-20T09:27:05.041Z","0.1.0":"2026-03-20T03:09:52.774Z","0.1.1":"2026-03-20T04:11:28.456Z","0.1.2":"2026-03-20T04:38:45.550Z","0.1.3":"2026-03-20T05:55:20.920Z","0.1.4":"2026-03-20T08:19:25.947Z","0.1.6":"2026-03-20T09:27:04.939Z"},"license":"MIT","keywords":["openclaw","mermaid","diagram","plugin","agent"],"description":"Agent-native diagram rendering pipeline with Mermaid-first support","maintainers":[{"name":"dmiyding","email":"dingmingyang123@gmail.com"}],"readme":"# Agent Diagram Pipeline\n\nAgent Diagram Pipeline is a docs-first project for turning AI-generated diagram source into deliverable visual artifacts.\n\nThe project starts from a concrete pain point:\n\n- AI tools often output Mermaid code instead of a usable diagram\n- end users consume results in chat channels, not only in web UIs\n- moving between third-party renderers breaks the workflow\n\nThis project treats diagram rendering as agent infrastructure, not a standalone toy converter.\n\n## Initial thesis\n\nThe first real integration target is OpenClaw.\n\nOpenClaw is a strong proving ground because:\n\n- it already supports agent tools\n- it already supports artifacts and viewers\n- it already sends files through multiple chat channels\n- the Mermaid pain appears in real user workflows\n\nThe goal is to build a renderer that can later serve:\n\n- OpenClaw\n- Codex-like local agents\n- Claude Code style tool pipelines\n- MCP or HTTP consumers\n\n## Project shape\n\nThis repository is intentionally documentation-first.\n\nCurrent scope:\n\n- define the product\n- define the architecture\n- define the MVP\n- define the OpenClaw integration strategy\n- define the expansion path\n- ship a working local Mermaid rendering pipeline\n\n## Docs\n\n- [Project Decision](docs/PROJECT_DECISION.md)\n- [Product Spec](docs/PRODUCT_SPEC.md)\n- [Architecture](docs/ARCHITECTURE.md)\n- [MVP Scope](docs/MVP.md)\n- [OpenClaw Integration](docs/OPENCLAW_INTEGRATION.md)\n- [Install In OpenClaw](docs/INSTALL_OPENCLAW.md)\n- [OpenClaw follow-up Mermaid images](docs/OPENCLAW_FOLLOW_UP_MERMAID.md)\n- [Roadmap](docs/ROADMAP.md)\n\n## Working name\n\n`agent-diagram-pipeline`\n\nThe name is deliberately broader than Mermaid because Mermaid should be the first engine, not the last one.\n\n## Current status\n\nThe project now includes a working local baseline pipeline for Mermaid:\n\n- Mermaid source to SVG\n- SVG to PNG\n- local artifact folder creation\n- local viewer HTML generation\n- CLI entry point\n- an OpenClaw adapter layer with:\n  - `render_diagram` tool factory\n  - plugin entry factory\n  - artifact HTTP handler\n  - prompt guidance for Mermaid-heavy agent turns\n\n## Local usage\n\nInstall dependencies:\n\n```bash\nnpm install\n```\n\nBuild:\n\n```bash\nnpm run build\n```\n\nValidate the package contract:\n\n```bash\nnpm run check\n```\n\nRender a diagram:\n\n```bash\nnode dist/cli.js render \\\n  --input ./example.mmd \\\n  --mode both \\\n  --fileFormat png \\\n  --theme dark \\\n  --title \"Example\"\n```\n\nThe command returns JSON with artifact paths for:\n\n- `diagram.svg`\n- `diagram.png`\n- `viewer.html`\n\nRun a local smoke test:\n\n```bash\nnpm run smoke\n```\n\n## OpenClaw adapter\n\nThe repository now includes a thin OpenClaw-oriented adapter in `src/adapters/openclaw`.\n\nIt provides:\n\n- `createOpenClawRenderDiagramTool()`\n- `createOpenClawRenderMermaidBlocksTool()`\n- `createOpenClawDiagramPlugin()`\n- `createOpenClawDiagramHttpHandler()`\n\nThe adapter is intentionally thin:\n\n- the core renderer stays independent\n- the OpenClaw layer only maps tool execution and artifact delivery\n- `viewerUrl` and file URLs are built from the artifact id and route prefix\n- `render_mermaid_blocks` can extract Mermaid directly from a markdown reply draft and emit attachment-ready images\n\n## Browser configuration\n\nRendering uses **Playwright + Chromium**. Prefer an explicit browser:\n\n- plugin config `browserPath` or `browserChannel`\n- env `OPENCLAW_DIAGRAM_BROWSER_PATH` or `OPENCLAW_DIAGRAM_BROWSER_CHANNEL`\n\nIf unset, the pipeline tries Playwright’s bundled Chromium, then common OS install paths (see `src/renderers/mermaid/runtime.ts`).\n\nOptional extras:\n\n- `browserArgs`, `headless`, `artifactDir`, env `OPENCLAW_DIAGRAM_ARTIFACT_DIR`\n- **`OPENCLAW_DIAGRAM_BROWSER_POOL=1`** — reuse one browser process across renders (lower latency on gateways; default off for CLI isolation)\n\nAfter install, run a local render smoke (no OpenClaw required):\n\n```bash\nnpm run diagnose\n```\n\n## Automatic follow-up images (`message_sent`)\n\nWhen `followUpMermaidImage` is on, the plugin sends **extra** native image messages after outbound text that contains fenced Mermaid.\n\n| Channel | Mechanism |\n| --- | --- |\n| Telegram / Discord / Slack | `runtime.channel.*.sendMessage*` with `mediaUrl` + `mediaLocalRoots` |\n| Feishu / Lark | `sendMediaFeishu` (or `sendMessageFeishu` fallback) on `runtime.channel.feishu` or `.lark` |\n| Webchat | **`runtime.outbound.deliverOutboundPayloads`** (payloads include `mediaUrl` / `mediaUrls`) — aligns with merged UI replies; fallback `sendMessageWebchat` if exposed |\n| Other channels | No auto follow-up — use **`render_diagram` / `render_mermaid_blocks`** so the model attaches artifacts or `MEDIA:` lines |\n\n**Follow-up tuning (env):**\n\n- `OPENCLAW_DIAGRAM_FOLLOW_UP_MAX_NODES` (default `120`), `OPENCLAW_DIAGRAM_FOLLOW_UP_MAX_EDGES` (default `200`) — skip very large diagrams fast\n- In-memory file cache reuses PNG paths for identical **source + title + theme + `artifactDir`** within TTL (see `follow-up-mermaid.ts`)\n\n**Screenshot stability:** Mermaid PNG uses a lower `deviceScaleFactor`, longer screenshot timeout, and **`page.screenshot({ clip })`** on `.preview-shell` instead of `locator.screenshot()` to reduce Playwright timeouts on large diagrams.\n\n## OpenClaw channel behavior (tools)\n\nFor every channel, the reliable path is:\n\n- keep the normal text reply\n- call `render_mermaid_blocks` or `render_diagram` when you need guaranteed attachments\n\nThe plugin emits `MEDIA:` directives where appropriate so OpenClaw can send real attachments. Feishu/Lark users should ensure **artifact / workspace paths** are allowed by OpenClaw’s local media policy (`mediaLocalRoots` / plugin follow-up roots).\n\n## Zero-config defaults\n\nThe plugin now defaults to:\n\n- `autoRenderMermaid: true`\n- `autoRenderMaxBlocks: 2`\n- loopback gateway base URL `http://127.0.0.1:18789` when no explicit `baseUrl` is configured\n\nYou can override with:\n\n- `baseUrl`\n- `OPENCLAW_DIAGRAM_BASE_URL`\n- `OPENCLAW_GATEWAY_PORT`\n","readmeFilename":"README.md"}