@adonis-agora/agent
Version:
Governed, durable-backed AI agent (chat + tool-calling + governance) for AdonisJS — part of the Agora ecosystem.
46 lines • 2.1 kB
TypeScript
/**
* Charts as images, for channels that take images but cannot draw a chart (WhatsApp, Telegram, an
* email): `chartSvg(props)` draws the builtin `Chart` (bar or line) as SVG, and `chartImages()` turns
* it into a PNG with `@resvg/resvg-js` — an OPTIONAL peer dependency, loaded only when a chart is
* actually drawn.
*
* ```ts
* import { chartImages } from '@adonis-agora/agent/genui/chart-image'
* genui({ catalog, channels: { whatsapp: { chartImages: chartImages() } } })
* ```
*/
import type { ChartImageRenderer } from './channels.js';
import type { ChartProps } from './registry.js';
export interface ChartSvgOptions {
/** Default 800. */
width?: number;
/** Default 450. */
height?: number;
/** Series colors, in order. Default: a palette readable on white. */
colors?: readonly string[];
/** Default `#ffffff`. */
background?: string;
/** Default `#1f2328`. */
foreground?: string;
/** Default: a list of common sans-serif families (resvg picks the first installed one). */
fontFamily?: string;
}
/** The builtin `Chart` as an SVG document: axes, gridlines, bars or lines, a legend for 2+ series. */
export declare function chartSvg(props: ChartProps, options?: ChartSvgOptions): string;
export interface ChartImagesOptions extends ChartSvgOptions {
/** The components drawn as images, all taking {@link ChartProps}. Default `['Chart']`. */
components?: readonly string[];
/** Font files for resvg (a server without system fonts draws no text otherwise). */
fontFiles?: readonly string[];
}
/** SVG → PNG bytes, with `@resvg/resvg-js`. */
export declare function svgToPng(svg: string, options?: {
width?: number;
fontFiles?: readonly string[];
}): Promise<Uint8Array>;
/**
* Charts as PNG images on a channel (`genui({ channels: { whatsapp: { chartImages: chartImages() } } })`).
* A chart the renderer cannot draw (resvg missing, bad props) falls back to its text summary.
*/
export declare function chartImages(options?: ChartImagesOptions): ChartImageRenderer;
//# sourceMappingURL=chart-image.d.ts.map