UNPKG

@adonis-agora/agent

Version:

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

42 lines • 1.97 kB
import { type GenerativeUIItem, type GenerativeUIOptions, type GenerativeUIState, type GenuiCatalogLike, type GenuiIssueLike, type GenuiRegistry, type GenuiRenderer, type ResolveComponent } from './types.js'; /** * Normalize whatever carries a pushed component: a transcript `ui` block, a `data-ui` message part * (`{ type: 'data-ui', id, data }`), a stored `{ id, component, props, version? }` entry. `null` for * anything else. */ export declare function toGenerativeUIItem(part: unknown): GenerativeUIItem | null; type Resolution = { status: 'ready'; Component: GenuiRenderer; } | { status: 'loading'; } | { status: 'unknown'; } | { status: 'error'; error: unknown; }; /** * Which renderer draws `name`: the registry first, then `resolveComponent` (cached; async results * re-render the caller when they land). `fallbackTree` answers the tree component when the * registry does not override it. */ export declare function useResolvedComponent(name: string, version: number | null, registry: GenuiRegistry, resolve: ResolveComponent | undefined, fallbackTree?: GenuiRenderer): Resolution; type Validation = { status: 'ok'; props: Record<string, unknown>; } | { status: 'pending'; } | { status: 'invalid'; issues: GenuiIssueLike[]; }; /** * Props checked against the catalog: synchronously when the catalog can (`validateSync`), else * after the async check settles. A component the catalog does not know passes through unchecked. */ export declare function useValidatedProps(catalog: GenuiCatalogLike | undefined, name: string, props: Record<string, unknown>): Validation; /** {@link import('./generative-ui.js').useGenerativeUI}, with the tree renderer handed in (avoids an import cycle). */ export declare function useGenerativeUIState(part: unknown, options: GenerativeUIOptions, fallbackTree: GenuiRenderer | undefined): GenerativeUIState | null; export {}; //# sourceMappingURL=use-generative-ui.d.ts.map