UNPKG

@adonis-agora/agent

Version:

Governed, durable-backed AI agent (chat + tool-calling + governance) for AdonisJS — part of the Agora ecosystem.

36 lines • 2.32 kB
import { type Catalog } from './catalog.js'; import { type JsonSchema } from './schema.js'; import { type GenuiElement } from './tree.js'; /** * Plain text (Slack mrkdwn compatible) for a pushed component: its definition's `fallbackText`, or * the props as a JSON block when the catalog has no text for it. A `fallbackText` that returns an * empty (or blank) string means "nothing to say" — a bare layout like `Stack` — and renders nothing. * A tree frame ({@link GENUI_TREE_COMPONENT}) renders node by node, so a layout's children still * render. Never throws — a fallback that fails prints the JSON instead. */ export declare function componentToText(catalog: Catalog, component: string, props: Record<string, unknown>): string; /** Plain text for a composed tree: each node's text, depth-first, blank-line free. */ export declare function treeToText(catalog: Catalog, root: GenuiElement): string; export interface CatalogTextOptions { /** * `per-component`: each component is its own tool (`ui__show_<snake>`), named in the text. * `tree`: one tool takes a nested `{ type, props, children }` tree; the text explains the format. * `show`: one tool takes `{ component, props }` (the generic show tool). Default `tree`. */ mode?: 'per-component' | 'tree' | 'show'; /** Tool-name prefix for `per-component`. Default `ui__show_`. */ namePrefix?: string; } /** * The catalog described for a model: one entry per model-facing component with its description and * a compact TypeScript-like signature of its props. What a tree-mode (or show) tool puts in its * description, and what a host can add to a system prompt. */ export declare function catalogToModelText(catalog: Catalog, options?: CatalogTextOptions): string; /** A JSON Schema as a one-line TypeScript-like type, e.g. `{ title?: string, rows: object[] }`. */ export declare function summarizeSchema(schema: unknown, root: JsonSchema, depth: number): string; /** Replace `{{path}}` placeholders with prop values (objects as JSON). */ export declare function fillTemplate(template: string, props: Record<string, unknown>): string; /** Read `a.b[0].c` from a value; `undefined` when any step is missing. */ export declare function getPath(source: unknown, path: string): unknown; //# sourceMappingURL=text.d.ts.map