/** * chartRender.js — local, server-side chart rendering skill (tier ①: API-only, * fully local — data NEVER leaves the box; no browser, no external service). * * WHAT IT IS * ────────── * A hand-written multi-tool skill (same shape as kvMemory.js / datasetStore.js / * github.js): `serverName`, `allowedTools`, `tools[]`, `handleToolCall`, and a * `resolve()` that spawns the GENERIC bin/mcp-skill.mjs. One tool — * `chart_render` — takes a RAW Apache ECharts option object (pass-through * dialect, NO invented normalized schema), renders it to SVG via ECharts' * zero-dependency pure-SVG SSR, and rasterizes to PNG via @resvg/resvg-js * (napi-rs PREBUILT binaries — no node-gyp; the code is structured so the * @resvg/resvg-wasm variant could be swapped in via loadResvg() if a target * ever lacks a prebuild). * * RENDER PIPELINE (validated by the research spike) * ───────────────────────────────────────────────── * echarts.init(null, null, { renderer:'svg', ssr:true, width, height }) * → chart.setOption(spec) → chart.renderToSVGString() → chart.dispose() * → (png/both) new Resvg(svg, { font }) → .render().asPng() * * FONTS — the agent container (node:20-bullseye-slim) may ship NO fonts, and * resvg renders EMPTY text without one. We bundle Noto Sans Regular + Bold * (SIL OFL 1.1 — license file alongside, assets/fonts/OFL.txt) and pass them * via resvg `font.fontFiles` + set 'Noto Sans' as the default ECharts * textStyle.fontFamily. `loadSystemFonts:true` stays on so a host WITH fonts * can still satisfy exotic families the spec asks for. * * OUTPUT FILES — same convention as the other artifact-writing surfaces: * files land under the run's session output dir so the CLI session-uploader * (which scans `//**`) auto-uploads them with the run: * 1. ZIBBY_NODE_SESSION_PATH (browser.js convention — /) * 2. ZIBBY_SESSION_PATH/chart-render (a node-shaped folder the uploader sees) * 3. /.zibby/output/charts (local dev fallback, agent-workflow's * DEFAULT_OUTPUT_BASE '.zibby/output') * * INLINE SVG (`output:'svg-inline'`) — the HTML-page path. A published * artifact/report page is strictly SELF-CONTAINED (a strict CSP blocks every * external host), so a file on disk is useless to it: the chart can only * appear as an inline element. This path writes NO file and returns the * markup in the tool result. See prepareInlineSvg() for the three transforms * that make ECharts' SSR output actually safe to paste into an HTML document * (they are NOT free — each one is a hazard verified against real output). * * SAFETY INJECTIONS before render (never trusts SSR text measurement): * - spec must be a plain JSON object (validated; clear errors for the LLM) * - animation is FORCED off (SSR has no frames) * - backgroundColor defaults to '#fff' (PNG would otherwise be transparent) * - width/height default 800×600, capped at 4096, floored at 16 * - very long labels in known label slots are truncated (SSR text * measurement is estimated — unbounded labels overflow the canvas) */ export declare const chartRenderSkill: any;