/** * Blog chart rendering (IMP-9xx) - BRIDGE side, on purpose. * * This used to live in the backend (`blog-ai.service.renderCharts`), next to a * synchronous LLM call the hub made on a human's behalf. Generation is now the * agent's harness running on THIS machine, so every deterministic step belongs * here too: the agent emits a `charts[]` block in its `post.json`, and this * module turns each entry into a real image URL and substitutes the placeholder * in the markdown. * * Keeping it on the bridge means the hub needs no provider key and no chart * rendering dependency, and the whole blog pipeline (author -> render -> deliver) * happens in one process the user already owns. * * Design constraints carried over from the original implementation, on purpose: * - `Promise.allSettled`, never `all`. ONE bad chart must never fail the post. * - Every URL is HEAD-verified, so a broken config degrades to a plain text * placeholder rather than shipping a dead image. * - Rendering is best-effort and its failure is reported, never thrown. */ /** One chart as the agent declares it in `post.json`. */ export interface BlogChartSpec { /** Unique token referenced from the markdown, e.g. "CHART_1". */ placeholder: string; /** Chart.js configuration object. */ config: Record; width?: number; height?: number; } /** TeamShare palette (see docs/ui-style-guide.md) - the agent is told to use it. */ export declare const BLOG_CHART_COLORS: readonly ["#6366f1", "#10b981", "#f59e0b", "#ef4444", "#8b5cf6"]; export interface RenderedCharts { /** placeholder -> rendered image URL (only successful renders). */ urls: Record; /** Human-readable lines for the run log. */ warnings: string[]; } /** Renders every chart and returns placeholder -> URL. Never throws. */ export declare function renderBlogCharts(charts: BlogChartSpec[] | undefined, log?: (text: string, level?: 'stdout' | 'stderr') => void): Promise; /** * Replaces `![alt](PLACEHOLDER)` references with the rendered image URLs. * * A placeholder with no matching render is left EXACTLY as written, so a failed * chart shows its alt text instead of a broken image - visible to the human, and * they can just ask the agent to fix it. */ export declare function substituteChartPlaceholders(content: string, urls: Record): string; /** Placeholders referenced in the markdown that were never rendered. */ export declare function unresolvedChartPlaceholders(content: string, charts: BlogChartSpec[] | undefined): string[];