@antipopp/agno-react 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +256 -4
- package/dist/index.d.ts +256 -4
- package/dist/index.js +709 -188
- package/dist/index.mjs +677 -188
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -2,8 +2,8 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { AgnoClient } from '@antipopp/agno-client';
|
|
4
4
|
import * as _antipopp_agno_types from '@antipopp/agno-types';
|
|
5
|
-
import { AgnoClientConfig, ToolCall, ChatMessage, ClientState, SessionEntry, AgentDetails, TeamDetails } from '@antipopp/agno-types';
|
|
6
|
-
export { AgentDetails, AgnoClientConfig, ChatMessage, ClientState, RunEvent, SessionEntry, TeamDetails, ToolCall } from '@antipopp/agno-types';
|
|
5
|
+
import { AgnoClientConfig, ToolCall, CustomRenderFunction, UIComponentSpec, ChartComponentSpec, CardData, CardGridComponentSpec, TableColumn, TableComponentSpec, MarkdownComponentSpec, ArtifactComponentSpec, ToolHandlerResult, ChatMessage, ClientState, SessionEntry, AgentDetails, TeamDetails } from '@antipopp/agno-types';
|
|
6
|
+
export { AgentDetails, AgnoClientConfig, ArtifactComponentSpec, CardData, CardGridComponentSpec, ChartComponentSpec, ChartSeries, ChatMessage, ClientState, CustomComponentSpec, GenerativeUIData, MarkdownComponentSpec, RunEvent, SessionEntry, TableColumn, TableComponentSpec, TeamDetails, ToolCall, ToolHandlerResult, UIComponentSpec } from '@antipopp/agno-types';
|
|
7
7
|
|
|
8
8
|
interface AgnoProviderProps {
|
|
9
9
|
config: AgnoClientConfig;
|
|
@@ -19,9 +19,13 @@ declare function AgnoProvider({ config, children }: AgnoProviderProps): react_js
|
|
|
19
19
|
declare function useAgnoClient(): AgnoClient;
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
|
-
* Tool handler function type
|
|
22
|
+
* Tool handler function type (now supports generative UI)
|
|
23
23
|
*/
|
|
24
24
|
type ToolHandler = (args: Record<string, any>) => Promise<any>;
|
|
25
|
+
/**
|
|
26
|
+
* Get a custom render function by key
|
|
27
|
+
*/
|
|
28
|
+
declare function getCustomRender(key: string): CustomRenderFunction | undefined;
|
|
25
29
|
/**
|
|
26
30
|
* Tool execution event payload
|
|
27
31
|
*/
|
|
@@ -111,6 +115,254 @@ declare function ToolHandlerProvider({ handlers: initialHandlers, children }: To
|
|
|
111
115
|
*/
|
|
112
116
|
declare function useToolHandlers(): ToolHandlerContextValue | null;
|
|
113
117
|
|
|
118
|
+
/**
|
|
119
|
+
* Generative UI Renderer
|
|
120
|
+
*
|
|
121
|
+
* Renders UI components based on specifications from the agent.
|
|
122
|
+
* Supports both registry-based components and custom render functions.
|
|
123
|
+
*/
|
|
124
|
+
|
|
125
|
+
interface GenerativeUIRendererProps {
|
|
126
|
+
/** The UI component specification to render */
|
|
127
|
+
spec: UIComponentSpec;
|
|
128
|
+
/** Optional className for styling */
|
|
129
|
+
className?: string;
|
|
130
|
+
/** Error boundary fallback */
|
|
131
|
+
onError?: (error: Error) => void;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Main Generative UI Renderer component
|
|
135
|
+
*/
|
|
136
|
+
declare function GenerativeUIRenderer({ spec, className, onError, }: GenerativeUIRendererProps): React.ReactElement;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Component Registry for Generative UI
|
|
140
|
+
*
|
|
141
|
+
* Maps component specifications to actual React components.
|
|
142
|
+
* Allows registering custom components at runtime.
|
|
143
|
+
*/
|
|
144
|
+
/**
|
|
145
|
+
* Component renderer function type
|
|
146
|
+
*/
|
|
147
|
+
type ComponentRenderer = (props: any) => any;
|
|
148
|
+
/**
|
|
149
|
+
* Component registry class
|
|
150
|
+
*/
|
|
151
|
+
declare class ComponentRegistry {
|
|
152
|
+
private static instance;
|
|
153
|
+
private components;
|
|
154
|
+
private constructor();
|
|
155
|
+
/**
|
|
156
|
+
* Get the singleton instance
|
|
157
|
+
*/
|
|
158
|
+
static getInstance(): ComponentRegistry;
|
|
159
|
+
/**
|
|
160
|
+
* Register a component renderer
|
|
161
|
+
*/
|
|
162
|
+
register(type: string, renderer: ComponentRenderer): void;
|
|
163
|
+
/**
|
|
164
|
+
* Register multiple components at once
|
|
165
|
+
*/
|
|
166
|
+
registerBatch(components: Record<string, ComponentRenderer>): void;
|
|
167
|
+
/**
|
|
168
|
+
* Get a registered component renderer
|
|
169
|
+
*/
|
|
170
|
+
get(type: string): ComponentRenderer | undefined;
|
|
171
|
+
/**
|
|
172
|
+
* Check if a component is registered
|
|
173
|
+
*/
|
|
174
|
+
has(type: string): boolean;
|
|
175
|
+
/**
|
|
176
|
+
* Unregister a component
|
|
177
|
+
*/
|
|
178
|
+
unregister(type: string): void;
|
|
179
|
+
/**
|
|
180
|
+
* Get all registered component types
|
|
181
|
+
*/
|
|
182
|
+
getRegisteredTypes(): string[];
|
|
183
|
+
/**
|
|
184
|
+
* Clear all registered components
|
|
185
|
+
*/
|
|
186
|
+
clear(): void;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Get the global component registry instance
|
|
190
|
+
*/
|
|
191
|
+
declare function getComponentRegistry(): ComponentRegistry;
|
|
192
|
+
/**
|
|
193
|
+
* Helper to register a chart component
|
|
194
|
+
*/
|
|
195
|
+
declare function registerChartComponent(name: string, renderer: ComponentRenderer): void;
|
|
196
|
+
/**
|
|
197
|
+
* Helper to get a chart component
|
|
198
|
+
*/
|
|
199
|
+
declare function getChartComponent(name: string): ComponentRenderer | undefined;
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Helper utilities for creating UI component specifications
|
|
203
|
+
*
|
|
204
|
+
* These helpers make it easy to create common UI patterns without
|
|
205
|
+
* manually constructing the full specification object.
|
|
206
|
+
*/
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Chart helper options
|
|
210
|
+
*/
|
|
211
|
+
interface ChartHelperOptions {
|
|
212
|
+
/** Chart title */
|
|
213
|
+
title?: string;
|
|
214
|
+
/** Chart description */
|
|
215
|
+
description?: string;
|
|
216
|
+
/** Layout preference */
|
|
217
|
+
layout?: 'inline' | 'artifact';
|
|
218
|
+
/** Show legend */
|
|
219
|
+
showLegend?: boolean;
|
|
220
|
+
/** Show grid */
|
|
221
|
+
showGrid?: boolean;
|
|
222
|
+
/** Chart height */
|
|
223
|
+
height?: number | string;
|
|
224
|
+
/** Chart width */
|
|
225
|
+
width?: number | string;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Create a bar chart specification
|
|
229
|
+
*/
|
|
230
|
+
declare function createBarChart(data: any[], xKey: string, bars: Array<{
|
|
231
|
+
key: string;
|
|
232
|
+
label?: string;
|
|
233
|
+
color?: string;
|
|
234
|
+
}>, options?: ChartHelperOptions): ChartComponentSpec;
|
|
235
|
+
/**
|
|
236
|
+
* Create a line chart specification
|
|
237
|
+
*/
|
|
238
|
+
declare function createLineChart(data: any[], xKey: string, lines: Array<{
|
|
239
|
+
key: string;
|
|
240
|
+
label?: string;
|
|
241
|
+
color?: string;
|
|
242
|
+
}>, options?: ChartHelperOptions): ChartComponentSpec;
|
|
243
|
+
/**
|
|
244
|
+
* Create a pie chart specification
|
|
245
|
+
*/
|
|
246
|
+
declare function createPieChart(data: any[], dataKey: string, nameKey: string, options?: ChartHelperOptions & {
|
|
247
|
+
showLabel?: boolean;
|
|
248
|
+
}): ChartComponentSpec;
|
|
249
|
+
/**
|
|
250
|
+
* Create an area chart specification
|
|
251
|
+
*/
|
|
252
|
+
declare function createAreaChart(data: any[], xKey: string, areas: Array<{
|
|
253
|
+
key: string;
|
|
254
|
+
label?: string;
|
|
255
|
+
color?: string;
|
|
256
|
+
}>, options?: ChartHelperOptions): ChartComponentSpec;
|
|
257
|
+
/**
|
|
258
|
+
* Card grid helper options
|
|
259
|
+
*/
|
|
260
|
+
interface CardGridHelperOptions {
|
|
261
|
+
title?: string;
|
|
262
|
+
description?: string;
|
|
263
|
+
layout?: 'inline' | 'artifact';
|
|
264
|
+
columns?: {
|
|
265
|
+
default?: number;
|
|
266
|
+
sm?: number;
|
|
267
|
+
md?: number;
|
|
268
|
+
lg?: number;
|
|
269
|
+
xl?: number;
|
|
270
|
+
};
|
|
271
|
+
variant?: 'default' | 'bordered' | 'elevated';
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Create a card grid specification
|
|
275
|
+
*/
|
|
276
|
+
declare function createCardGrid(cards: CardData[], options?: CardGridHelperOptions): CardGridComponentSpec;
|
|
277
|
+
/**
|
|
278
|
+
* Create a simple card
|
|
279
|
+
*/
|
|
280
|
+
declare function createCard(id: string, title: string, description?: string, options?: {
|
|
281
|
+
image?: string;
|
|
282
|
+
metadata?: Record<string, any>;
|
|
283
|
+
actions?: CardData['actions'];
|
|
284
|
+
}): CardData;
|
|
285
|
+
/**
|
|
286
|
+
* Table helper options
|
|
287
|
+
*/
|
|
288
|
+
interface TableHelperOptions {
|
|
289
|
+
title?: string;
|
|
290
|
+
description?: string;
|
|
291
|
+
layout?: 'inline' | 'artifact';
|
|
292
|
+
sortable?: boolean;
|
|
293
|
+
filterable?: boolean;
|
|
294
|
+
pagination?: {
|
|
295
|
+
pageSize?: number;
|
|
296
|
+
pageSizeOptions?: number[];
|
|
297
|
+
};
|
|
298
|
+
density?: 'comfortable' | 'compact';
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Create a table specification
|
|
302
|
+
*/
|
|
303
|
+
declare function createTable(data: Record<string, any>[], columns: TableColumn[], options?: TableHelperOptions): TableComponentSpec;
|
|
304
|
+
/**
|
|
305
|
+
* Create a table column definition
|
|
306
|
+
*/
|
|
307
|
+
declare function createColumn(key: string, header: string, options?: {
|
|
308
|
+
width?: number | string;
|
|
309
|
+
sortable?: boolean;
|
|
310
|
+
cellType?: 'text' | 'number' | 'date' | 'badge' | 'link';
|
|
311
|
+
format?: TableColumn['format'];
|
|
312
|
+
}): TableColumn;
|
|
313
|
+
/**
|
|
314
|
+
* Create a markdown specification
|
|
315
|
+
*/
|
|
316
|
+
declare function createMarkdown(content: string, options?: {
|
|
317
|
+
title?: string;
|
|
318
|
+
description?: string;
|
|
319
|
+
layout?: 'inline' | 'artifact';
|
|
320
|
+
syntaxHighlight?: boolean;
|
|
321
|
+
}): MarkdownComponentSpec;
|
|
322
|
+
/**
|
|
323
|
+
* Create an artifact container with multiple child components
|
|
324
|
+
*/
|
|
325
|
+
declare function createArtifact(content: UIComponentSpec[], options?: {
|
|
326
|
+
title?: string;
|
|
327
|
+
description?: string;
|
|
328
|
+
variant?: 'default' | 'bordered' | 'elevated';
|
|
329
|
+
}): ArtifactComponentSpec;
|
|
330
|
+
/**
|
|
331
|
+
* Smart chart creator - automatically chooses the best chart type based on data
|
|
332
|
+
*/
|
|
333
|
+
declare function createSmartChart(data: any[], options?: {
|
|
334
|
+
title?: string;
|
|
335
|
+
description?: string;
|
|
336
|
+
layout?: 'inline' | 'artifact';
|
|
337
|
+
xKey?: string;
|
|
338
|
+
yKeys?: string[];
|
|
339
|
+
preferredType?: 'bar' | 'line' | 'area' | 'pie';
|
|
340
|
+
}): ChartComponentSpec;
|
|
341
|
+
/**
|
|
342
|
+
* Wrap data and UI into a ToolHandlerResult
|
|
343
|
+
*/
|
|
344
|
+
declare function createToolResult(data: any, ui: UIComponentSpec): ToolHandlerResult;
|
|
345
|
+
/**
|
|
346
|
+
* Quick helper: create a tool result with a bar chart
|
|
347
|
+
*/
|
|
348
|
+
declare function resultWithBarChart(data: any[], xKey: string, bars: Array<{
|
|
349
|
+
key: string;
|
|
350
|
+
label?: string;
|
|
351
|
+
color?: string;
|
|
352
|
+
}>, options?: ChartHelperOptions): ToolHandlerResult;
|
|
353
|
+
/**
|
|
354
|
+
* Quick helper: create a tool result with a smart chart
|
|
355
|
+
*/
|
|
356
|
+
declare function resultWithSmartChart(data: any[], options?: Parameters<typeof createSmartChart>[1]): ToolHandlerResult;
|
|
357
|
+
/**
|
|
358
|
+
* Quick helper: create a tool result with a card grid
|
|
359
|
+
*/
|
|
360
|
+
declare function resultWithCardGrid(cards: CardData[], options?: CardGridHelperOptions): ToolHandlerResult;
|
|
361
|
+
/**
|
|
362
|
+
* Quick helper: create a tool result with a table
|
|
363
|
+
*/
|
|
364
|
+
declare function resultWithTable(data: Record<string, any>[], columns: TableColumn[], options?: TableHelperOptions): ToolHandlerResult;
|
|
365
|
+
|
|
114
366
|
/**
|
|
115
367
|
* Main hook for chat interactions
|
|
116
368
|
* Provides messages, state, and methods to interact with the agent
|
|
@@ -155,4 +407,4 @@ declare function useAgnoActions(): {
|
|
|
155
407
|
error: string | undefined;
|
|
156
408
|
};
|
|
157
409
|
|
|
158
|
-
export { AgnoProvider, type AgnoProviderProps, type ToolExecutionEvent, type ToolHandler, type ToolHandlerContextValue, ToolHandlerProvider, type ToolHandlerProviderProps, useAgnoActions, useAgnoChat, useAgnoClient, useAgnoSession, useAgnoToolExecution, useToolHandlers };
|
|
410
|
+
export { AgnoProvider, type AgnoProviderProps, type CardGridHelperOptions, type ChartHelperOptions, ComponentRegistry, type ComponentRenderer, GenerativeUIRenderer, type GenerativeUIRendererProps, type TableHelperOptions, type ToolExecutionEvent, type ToolHandler, type ToolHandlerContextValue, ToolHandlerProvider, type ToolHandlerProviderProps, createAreaChart, createArtifact, createBarChart, createCard, createCardGrid, createColumn, createLineChart, createMarkdown, createPieChart, createSmartChart, createTable, createToolResult, getChartComponent, getComponentRegistry, getCustomRender, registerChartComponent, resultWithBarChart, resultWithCardGrid, resultWithSmartChart, resultWithTable, useAgnoActions, useAgnoChat, useAgnoClient, useAgnoSession, useAgnoToolExecution, useToolHandlers };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { AgnoClient } from '@antipopp/agno-client';
|
|
4
4
|
import * as _antipopp_agno_types from '@antipopp/agno-types';
|
|
5
|
-
import { AgnoClientConfig, ToolCall, ChatMessage, ClientState, SessionEntry, AgentDetails, TeamDetails } from '@antipopp/agno-types';
|
|
6
|
-
export { AgentDetails, AgnoClientConfig, ChatMessage, ClientState, RunEvent, SessionEntry, TeamDetails, ToolCall } from '@antipopp/agno-types';
|
|
5
|
+
import { AgnoClientConfig, ToolCall, CustomRenderFunction, UIComponentSpec, ChartComponentSpec, CardData, CardGridComponentSpec, TableColumn, TableComponentSpec, MarkdownComponentSpec, ArtifactComponentSpec, ToolHandlerResult, ChatMessage, ClientState, SessionEntry, AgentDetails, TeamDetails } from '@antipopp/agno-types';
|
|
6
|
+
export { AgentDetails, AgnoClientConfig, ArtifactComponentSpec, CardData, CardGridComponentSpec, ChartComponentSpec, ChartSeries, ChatMessage, ClientState, CustomComponentSpec, GenerativeUIData, MarkdownComponentSpec, RunEvent, SessionEntry, TableColumn, TableComponentSpec, TeamDetails, ToolCall, ToolHandlerResult, UIComponentSpec } from '@antipopp/agno-types';
|
|
7
7
|
|
|
8
8
|
interface AgnoProviderProps {
|
|
9
9
|
config: AgnoClientConfig;
|
|
@@ -19,9 +19,13 @@ declare function AgnoProvider({ config, children }: AgnoProviderProps): react_js
|
|
|
19
19
|
declare function useAgnoClient(): AgnoClient;
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
|
-
* Tool handler function type
|
|
22
|
+
* Tool handler function type (now supports generative UI)
|
|
23
23
|
*/
|
|
24
24
|
type ToolHandler = (args: Record<string, any>) => Promise<any>;
|
|
25
|
+
/**
|
|
26
|
+
* Get a custom render function by key
|
|
27
|
+
*/
|
|
28
|
+
declare function getCustomRender(key: string): CustomRenderFunction | undefined;
|
|
25
29
|
/**
|
|
26
30
|
* Tool execution event payload
|
|
27
31
|
*/
|
|
@@ -111,6 +115,254 @@ declare function ToolHandlerProvider({ handlers: initialHandlers, children }: To
|
|
|
111
115
|
*/
|
|
112
116
|
declare function useToolHandlers(): ToolHandlerContextValue | null;
|
|
113
117
|
|
|
118
|
+
/**
|
|
119
|
+
* Generative UI Renderer
|
|
120
|
+
*
|
|
121
|
+
* Renders UI components based on specifications from the agent.
|
|
122
|
+
* Supports both registry-based components and custom render functions.
|
|
123
|
+
*/
|
|
124
|
+
|
|
125
|
+
interface GenerativeUIRendererProps {
|
|
126
|
+
/** The UI component specification to render */
|
|
127
|
+
spec: UIComponentSpec;
|
|
128
|
+
/** Optional className for styling */
|
|
129
|
+
className?: string;
|
|
130
|
+
/** Error boundary fallback */
|
|
131
|
+
onError?: (error: Error) => void;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Main Generative UI Renderer component
|
|
135
|
+
*/
|
|
136
|
+
declare function GenerativeUIRenderer({ spec, className, onError, }: GenerativeUIRendererProps): React.ReactElement;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Component Registry for Generative UI
|
|
140
|
+
*
|
|
141
|
+
* Maps component specifications to actual React components.
|
|
142
|
+
* Allows registering custom components at runtime.
|
|
143
|
+
*/
|
|
144
|
+
/**
|
|
145
|
+
* Component renderer function type
|
|
146
|
+
*/
|
|
147
|
+
type ComponentRenderer = (props: any) => any;
|
|
148
|
+
/**
|
|
149
|
+
* Component registry class
|
|
150
|
+
*/
|
|
151
|
+
declare class ComponentRegistry {
|
|
152
|
+
private static instance;
|
|
153
|
+
private components;
|
|
154
|
+
private constructor();
|
|
155
|
+
/**
|
|
156
|
+
* Get the singleton instance
|
|
157
|
+
*/
|
|
158
|
+
static getInstance(): ComponentRegistry;
|
|
159
|
+
/**
|
|
160
|
+
* Register a component renderer
|
|
161
|
+
*/
|
|
162
|
+
register(type: string, renderer: ComponentRenderer): void;
|
|
163
|
+
/**
|
|
164
|
+
* Register multiple components at once
|
|
165
|
+
*/
|
|
166
|
+
registerBatch(components: Record<string, ComponentRenderer>): void;
|
|
167
|
+
/**
|
|
168
|
+
* Get a registered component renderer
|
|
169
|
+
*/
|
|
170
|
+
get(type: string): ComponentRenderer | undefined;
|
|
171
|
+
/**
|
|
172
|
+
* Check if a component is registered
|
|
173
|
+
*/
|
|
174
|
+
has(type: string): boolean;
|
|
175
|
+
/**
|
|
176
|
+
* Unregister a component
|
|
177
|
+
*/
|
|
178
|
+
unregister(type: string): void;
|
|
179
|
+
/**
|
|
180
|
+
* Get all registered component types
|
|
181
|
+
*/
|
|
182
|
+
getRegisteredTypes(): string[];
|
|
183
|
+
/**
|
|
184
|
+
* Clear all registered components
|
|
185
|
+
*/
|
|
186
|
+
clear(): void;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Get the global component registry instance
|
|
190
|
+
*/
|
|
191
|
+
declare function getComponentRegistry(): ComponentRegistry;
|
|
192
|
+
/**
|
|
193
|
+
* Helper to register a chart component
|
|
194
|
+
*/
|
|
195
|
+
declare function registerChartComponent(name: string, renderer: ComponentRenderer): void;
|
|
196
|
+
/**
|
|
197
|
+
* Helper to get a chart component
|
|
198
|
+
*/
|
|
199
|
+
declare function getChartComponent(name: string): ComponentRenderer | undefined;
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Helper utilities for creating UI component specifications
|
|
203
|
+
*
|
|
204
|
+
* These helpers make it easy to create common UI patterns without
|
|
205
|
+
* manually constructing the full specification object.
|
|
206
|
+
*/
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Chart helper options
|
|
210
|
+
*/
|
|
211
|
+
interface ChartHelperOptions {
|
|
212
|
+
/** Chart title */
|
|
213
|
+
title?: string;
|
|
214
|
+
/** Chart description */
|
|
215
|
+
description?: string;
|
|
216
|
+
/** Layout preference */
|
|
217
|
+
layout?: 'inline' | 'artifact';
|
|
218
|
+
/** Show legend */
|
|
219
|
+
showLegend?: boolean;
|
|
220
|
+
/** Show grid */
|
|
221
|
+
showGrid?: boolean;
|
|
222
|
+
/** Chart height */
|
|
223
|
+
height?: number | string;
|
|
224
|
+
/** Chart width */
|
|
225
|
+
width?: number | string;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Create a bar chart specification
|
|
229
|
+
*/
|
|
230
|
+
declare function createBarChart(data: any[], xKey: string, bars: Array<{
|
|
231
|
+
key: string;
|
|
232
|
+
label?: string;
|
|
233
|
+
color?: string;
|
|
234
|
+
}>, options?: ChartHelperOptions): ChartComponentSpec;
|
|
235
|
+
/**
|
|
236
|
+
* Create a line chart specification
|
|
237
|
+
*/
|
|
238
|
+
declare function createLineChart(data: any[], xKey: string, lines: Array<{
|
|
239
|
+
key: string;
|
|
240
|
+
label?: string;
|
|
241
|
+
color?: string;
|
|
242
|
+
}>, options?: ChartHelperOptions): ChartComponentSpec;
|
|
243
|
+
/**
|
|
244
|
+
* Create a pie chart specification
|
|
245
|
+
*/
|
|
246
|
+
declare function createPieChart(data: any[], dataKey: string, nameKey: string, options?: ChartHelperOptions & {
|
|
247
|
+
showLabel?: boolean;
|
|
248
|
+
}): ChartComponentSpec;
|
|
249
|
+
/**
|
|
250
|
+
* Create an area chart specification
|
|
251
|
+
*/
|
|
252
|
+
declare function createAreaChart(data: any[], xKey: string, areas: Array<{
|
|
253
|
+
key: string;
|
|
254
|
+
label?: string;
|
|
255
|
+
color?: string;
|
|
256
|
+
}>, options?: ChartHelperOptions): ChartComponentSpec;
|
|
257
|
+
/**
|
|
258
|
+
* Card grid helper options
|
|
259
|
+
*/
|
|
260
|
+
interface CardGridHelperOptions {
|
|
261
|
+
title?: string;
|
|
262
|
+
description?: string;
|
|
263
|
+
layout?: 'inline' | 'artifact';
|
|
264
|
+
columns?: {
|
|
265
|
+
default?: number;
|
|
266
|
+
sm?: number;
|
|
267
|
+
md?: number;
|
|
268
|
+
lg?: number;
|
|
269
|
+
xl?: number;
|
|
270
|
+
};
|
|
271
|
+
variant?: 'default' | 'bordered' | 'elevated';
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Create a card grid specification
|
|
275
|
+
*/
|
|
276
|
+
declare function createCardGrid(cards: CardData[], options?: CardGridHelperOptions): CardGridComponentSpec;
|
|
277
|
+
/**
|
|
278
|
+
* Create a simple card
|
|
279
|
+
*/
|
|
280
|
+
declare function createCard(id: string, title: string, description?: string, options?: {
|
|
281
|
+
image?: string;
|
|
282
|
+
metadata?: Record<string, any>;
|
|
283
|
+
actions?: CardData['actions'];
|
|
284
|
+
}): CardData;
|
|
285
|
+
/**
|
|
286
|
+
* Table helper options
|
|
287
|
+
*/
|
|
288
|
+
interface TableHelperOptions {
|
|
289
|
+
title?: string;
|
|
290
|
+
description?: string;
|
|
291
|
+
layout?: 'inline' | 'artifact';
|
|
292
|
+
sortable?: boolean;
|
|
293
|
+
filterable?: boolean;
|
|
294
|
+
pagination?: {
|
|
295
|
+
pageSize?: number;
|
|
296
|
+
pageSizeOptions?: number[];
|
|
297
|
+
};
|
|
298
|
+
density?: 'comfortable' | 'compact';
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Create a table specification
|
|
302
|
+
*/
|
|
303
|
+
declare function createTable(data: Record<string, any>[], columns: TableColumn[], options?: TableHelperOptions): TableComponentSpec;
|
|
304
|
+
/**
|
|
305
|
+
* Create a table column definition
|
|
306
|
+
*/
|
|
307
|
+
declare function createColumn(key: string, header: string, options?: {
|
|
308
|
+
width?: number | string;
|
|
309
|
+
sortable?: boolean;
|
|
310
|
+
cellType?: 'text' | 'number' | 'date' | 'badge' | 'link';
|
|
311
|
+
format?: TableColumn['format'];
|
|
312
|
+
}): TableColumn;
|
|
313
|
+
/**
|
|
314
|
+
* Create a markdown specification
|
|
315
|
+
*/
|
|
316
|
+
declare function createMarkdown(content: string, options?: {
|
|
317
|
+
title?: string;
|
|
318
|
+
description?: string;
|
|
319
|
+
layout?: 'inline' | 'artifact';
|
|
320
|
+
syntaxHighlight?: boolean;
|
|
321
|
+
}): MarkdownComponentSpec;
|
|
322
|
+
/**
|
|
323
|
+
* Create an artifact container with multiple child components
|
|
324
|
+
*/
|
|
325
|
+
declare function createArtifact(content: UIComponentSpec[], options?: {
|
|
326
|
+
title?: string;
|
|
327
|
+
description?: string;
|
|
328
|
+
variant?: 'default' | 'bordered' | 'elevated';
|
|
329
|
+
}): ArtifactComponentSpec;
|
|
330
|
+
/**
|
|
331
|
+
* Smart chart creator - automatically chooses the best chart type based on data
|
|
332
|
+
*/
|
|
333
|
+
declare function createSmartChart(data: any[], options?: {
|
|
334
|
+
title?: string;
|
|
335
|
+
description?: string;
|
|
336
|
+
layout?: 'inline' | 'artifact';
|
|
337
|
+
xKey?: string;
|
|
338
|
+
yKeys?: string[];
|
|
339
|
+
preferredType?: 'bar' | 'line' | 'area' | 'pie';
|
|
340
|
+
}): ChartComponentSpec;
|
|
341
|
+
/**
|
|
342
|
+
* Wrap data and UI into a ToolHandlerResult
|
|
343
|
+
*/
|
|
344
|
+
declare function createToolResult(data: any, ui: UIComponentSpec): ToolHandlerResult;
|
|
345
|
+
/**
|
|
346
|
+
* Quick helper: create a tool result with a bar chart
|
|
347
|
+
*/
|
|
348
|
+
declare function resultWithBarChart(data: any[], xKey: string, bars: Array<{
|
|
349
|
+
key: string;
|
|
350
|
+
label?: string;
|
|
351
|
+
color?: string;
|
|
352
|
+
}>, options?: ChartHelperOptions): ToolHandlerResult;
|
|
353
|
+
/**
|
|
354
|
+
* Quick helper: create a tool result with a smart chart
|
|
355
|
+
*/
|
|
356
|
+
declare function resultWithSmartChart(data: any[], options?: Parameters<typeof createSmartChart>[1]): ToolHandlerResult;
|
|
357
|
+
/**
|
|
358
|
+
* Quick helper: create a tool result with a card grid
|
|
359
|
+
*/
|
|
360
|
+
declare function resultWithCardGrid(cards: CardData[], options?: CardGridHelperOptions): ToolHandlerResult;
|
|
361
|
+
/**
|
|
362
|
+
* Quick helper: create a tool result with a table
|
|
363
|
+
*/
|
|
364
|
+
declare function resultWithTable(data: Record<string, any>[], columns: TableColumn[], options?: TableHelperOptions): ToolHandlerResult;
|
|
365
|
+
|
|
114
366
|
/**
|
|
115
367
|
* Main hook for chat interactions
|
|
116
368
|
* Provides messages, state, and methods to interact with the agent
|
|
@@ -155,4 +407,4 @@ declare function useAgnoActions(): {
|
|
|
155
407
|
error: string | undefined;
|
|
156
408
|
};
|
|
157
409
|
|
|
158
|
-
export { AgnoProvider, type AgnoProviderProps, type ToolExecutionEvent, type ToolHandler, type ToolHandlerContextValue, ToolHandlerProvider, type ToolHandlerProviderProps, useAgnoActions, useAgnoChat, useAgnoClient, useAgnoSession, useAgnoToolExecution, useToolHandlers };
|
|
410
|
+
export { AgnoProvider, type AgnoProviderProps, type CardGridHelperOptions, type ChartHelperOptions, ComponentRegistry, type ComponentRenderer, GenerativeUIRenderer, type GenerativeUIRendererProps, type TableHelperOptions, type ToolExecutionEvent, type ToolHandler, type ToolHandlerContextValue, ToolHandlerProvider, type ToolHandlerProviderProps, createAreaChart, createArtifact, createBarChart, createCard, createCardGrid, createColumn, createLineChart, createMarkdown, createPieChart, createSmartChart, createTable, createToolResult, getChartComponent, getComponentRegistry, getCustomRender, registerChartComponent, resultWithBarChart, resultWithCardGrid, resultWithSmartChart, resultWithTable, useAgnoActions, useAgnoChat, useAgnoClient, useAgnoSession, useAgnoToolExecution, useToolHandlers };
|