@antipopp/agno-react 0.9.0 → 0.10.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 +107 -92
- package/dist/index.d.ts +107 -92
- package/dist/index.js +480 -382
- package/dist/index.mjs +490 -393
- package/package.json +13 -5
package/dist/index.d.mts
CHANGED
|
@@ -1,16 +1,37 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { AgnoClient } from '@antipopp/agno-client';
|
|
4
1
|
import * as _antipopp_agno_types from '@antipopp/agno-types';
|
|
5
|
-
import { AgnoClientConfig, ToolCall, CustomRenderFunction,
|
|
2
|
+
import { UIComponentSpec, AgnoClientConfig, ToolCall, CustomRenderFunction, AgentDetails, TeamDetails, ChatMessage, ClientState, SessionEntry, ChartComponentSpec, ArtifactComponentSpec, CardData, CardGridComponentSpec, TableColumn, MarkdownComponentSpec, TableComponentSpec, ToolHandlerResult } from '@antipopp/agno-types';
|
|
6
3
|
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';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
|
+
import { AgnoClient } from '@antipopp/agno-client';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Generative UI Renderer
|
|
10
|
+
*
|
|
11
|
+
* Renders UI components based on specifications from the agent.
|
|
12
|
+
* Supports both registry-based components and custom render functions.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
interface GenerativeUIRendererProps {
|
|
16
|
+
/** The UI component specification to render */
|
|
17
|
+
spec: UIComponentSpec;
|
|
18
|
+
/** Optional className for styling */
|
|
19
|
+
className?: string;
|
|
20
|
+
/** Error boundary fallback */
|
|
21
|
+
onError?: (error: Error) => void;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Main Generative UI Renderer component
|
|
25
|
+
*/
|
|
26
|
+
declare function GenerativeUIRenderer({ spec, className, onError, }: GenerativeUIRendererProps): React.ReactElement;
|
|
7
27
|
|
|
8
28
|
interface AgnoProviderProps {
|
|
9
29
|
config: AgnoClientConfig;
|
|
10
30
|
children: React.ReactNode;
|
|
11
31
|
}
|
|
12
32
|
/**
|
|
13
|
-
* Provider component that creates and manages an AgnoClient instance
|
|
33
|
+
* Provider component that creates and manages an AgnoClient instance.
|
|
34
|
+
* Handles cleanup of all module-level registries on unmount to prevent memory leaks.
|
|
14
35
|
*/
|
|
15
36
|
declare function AgnoProvider({ config, children }: AgnoProviderProps): react_jsx_runtime.JSX.Element;
|
|
16
37
|
/**
|
|
@@ -26,6 +47,11 @@ type ToolHandler = (args: Record<string, any>) => Promise<any>;
|
|
|
26
47
|
* Get a custom render function by key
|
|
27
48
|
*/
|
|
28
49
|
declare function getCustomRender(key: string): CustomRenderFunction | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Clear all custom render functions from the registry.
|
|
52
|
+
* Call this during cleanup (e.g., when AgnoProvider unmounts) to prevent memory leaks.
|
|
53
|
+
*/
|
|
54
|
+
declare function clearCustomRenderRegistry(): void;
|
|
29
55
|
/**
|
|
30
56
|
* Tool execution event payload
|
|
31
57
|
*/
|
|
@@ -108,7 +134,7 @@ interface ToolHandlerProviderProps {
|
|
|
108
134
|
* </ToolHandlerProvider>
|
|
109
135
|
* ```
|
|
110
136
|
*/
|
|
111
|
-
declare function ToolHandlerProvider({ handlers: initialHandlers, children }: ToolHandlerProviderProps): react_jsx_runtime.JSX.Element;
|
|
137
|
+
declare function ToolHandlerProvider({ handlers: initialHandlers, children, }: ToolHandlerProviderProps): react_jsx_runtime.JSX.Element;
|
|
112
138
|
/**
|
|
113
139
|
* Hook to access global tool handlers
|
|
114
140
|
*
|
|
@@ -122,24 +148,65 @@ declare function ToolHandlerProvider({ handlers: initialHandlers, children }: To
|
|
|
122
148
|
declare function useToolHandlers(): ToolHandlerContextValue | null;
|
|
123
149
|
|
|
124
150
|
/**
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
* Renders UI components based on specifications from the agent.
|
|
128
|
-
* Supports both registry-based components and custom render functions.
|
|
151
|
+
* Hook for common actions like initialization, fetching agents/teams
|
|
129
152
|
*/
|
|
153
|
+
declare function useAgnoActions(): {
|
|
154
|
+
initialize: (options?: {
|
|
155
|
+
params?: Record<string, string>;
|
|
156
|
+
}) => Promise<{
|
|
157
|
+
agents: AgentDetails[];
|
|
158
|
+
teams: TeamDetails[];
|
|
159
|
+
}>;
|
|
160
|
+
checkStatus: (options?: {
|
|
161
|
+
params?: Record<string, string>;
|
|
162
|
+
}) => Promise<boolean>;
|
|
163
|
+
fetchAgents: (options?: {
|
|
164
|
+
params?: Record<string, string>;
|
|
165
|
+
}) => Promise<AgentDetails[]>;
|
|
166
|
+
fetchTeams: (options?: {
|
|
167
|
+
params?: Record<string, string>;
|
|
168
|
+
}) => Promise<TeamDetails[]>;
|
|
169
|
+
updateConfig: (updates: Partial<Parameters<(updates: Partial<_antipopp_agno_types.AgnoClientConfig>) => void>[0]>) => void;
|
|
170
|
+
isInitializing: boolean;
|
|
171
|
+
error: string | undefined;
|
|
172
|
+
};
|
|
130
173
|
|
|
131
|
-
interface GenerativeUIRendererProps {
|
|
132
|
-
/** The UI component specification to render */
|
|
133
|
-
spec: UIComponentSpec;
|
|
134
|
-
/** Optional className for styling */
|
|
135
|
-
className?: string;
|
|
136
|
-
/** Error boundary fallback */
|
|
137
|
-
onError?: (error: Error) => void;
|
|
138
|
-
}
|
|
139
174
|
/**
|
|
140
|
-
* Main
|
|
175
|
+
* Main hook for chat interactions
|
|
176
|
+
* Provides messages, state, and methods to interact with the agent
|
|
141
177
|
*/
|
|
142
|
-
declare function
|
|
178
|
+
declare function useAgnoChat(): {
|
|
179
|
+
messages: ChatMessage[];
|
|
180
|
+
sendMessage: (message: string | FormData, options?: {
|
|
181
|
+
headers?: Record<string, string>;
|
|
182
|
+
params?: Record<string, string>;
|
|
183
|
+
}) => Promise<void>;
|
|
184
|
+
clearMessages: () => void;
|
|
185
|
+
cancelRun: () => Promise<void>;
|
|
186
|
+
isStreaming: boolean;
|
|
187
|
+
isRefreshing: boolean;
|
|
188
|
+
isPaused: boolean;
|
|
189
|
+
isCancelling: boolean;
|
|
190
|
+
currentRunId: string | undefined;
|
|
191
|
+
error: string | undefined;
|
|
192
|
+
state: ClientState;
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Hook for session management
|
|
197
|
+
*/
|
|
198
|
+
declare function useAgnoSession(): {
|
|
199
|
+
sessions: SessionEntry[];
|
|
200
|
+
currentSessionId: string | undefined;
|
|
201
|
+
loadSession: (sessionId: string, options?: {
|
|
202
|
+
params?: Record<string, string>;
|
|
203
|
+
}) => Promise<ChatMessage[]>;
|
|
204
|
+
fetchSessions: (options?: {
|
|
205
|
+
params?: Record<string, string>;
|
|
206
|
+
}) => Promise<SessionEntry[]>;
|
|
207
|
+
isLoading: boolean;
|
|
208
|
+
error: string | undefined;
|
|
209
|
+
};
|
|
143
210
|
|
|
144
211
|
/**
|
|
145
212
|
* Component Registry for Generative UI
|
|
@@ -156,7 +223,7 @@ type ComponentRenderer = (props: any) => any;
|
|
|
156
223
|
*/
|
|
157
224
|
declare class ComponentRegistry {
|
|
158
225
|
private static instance;
|
|
159
|
-
private components;
|
|
226
|
+
private readonly components;
|
|
160
227
|
private constructor();
|
|
161
228
|
/**
|
|
162
229
|
* Get the singleton instance
|
|
@@ -190,6 +257,12 @@ declare class ComponentRegistry {
|
|
|
190
257
|
* Clear all registered components
|
|
191
258
|
*/
|
|
192
259
|
clear(): void;
|
|
260
|
+
/**
|
|
261
|
+
* Reset the singleton instance.
|
|
262
|
+
* Call this during cleanup (e.g., when AgnoProvider unmounts) to prevent memory leaks.
|
|
263
|
+
* After calling this, getInstance() will create a fresh instance.
|
|
264
|
+
*/
|
|
265
|
+
static resetInstance(): void;
|
|
193
266
|
}
|
|
194
267
|
/**
|
|
195
268
|
* Get the global component registry instance
|
|
@@ -220,7 +293,7 @@ interface ChartHelperOptions {
|
|
|
220
293
|
/** Chart description */
|
|
221
294
|
description?: string;
|
|
222
295
|
/** Layout preference */
|
|
223
|
-
layout?:
|
|
296
|
+
layout?: "inline" | "artifact";
|
|
224
297
|
/** Show legend */
|
|
225
298
|
showLegend?: boolean;
|
|
226
299
|
/** Show grid */
|
|
@@ -266,7 +339,7 @@ declare function createAreaChart(data: any[], xKey: string, areas: Array<{
|
|
|
266
339
|
interface CardGridHelperOptions {
|
|
267
340
|
title?: string;
|
|
268
341
|
description?: string;
|
|
269
|
-
layout?:
|
|
342
|
+
layout?: "inline" | "artifact";
|
|
270
343
|
columns?: {
|
|
271
344
|
default?: number;
|
|
272
345
|
sm?: number;
|
|
@@ -274,7 +347,7 @@ interface CardGridHelperOptions {
|
|
|
274
347
|
lg?: number;
|
|
275
348
|
xl?: number;
|
|
276
349
|
};
|
|
277
|
-
variant?:
|
|
350
|
+
variant?: "default" | "bordered" | "elevated";
|
|
278
351
|
}
|
|
279
352
|
/**
|
|
280
353
|
* Create a card grid specification
|
|
@@ -286,7 +359,7 @@ declare function createCardGrid(cards: CardData[], options?: CardGridHelperOptio
|
|
|
286
359
|
declare function createCard(id: string, title: string, description?: string, options?: {
|
|
287
360
|
image?: string;
|
|
288
361
|
metadata?: Record<string, any>;
|
|
289
|
-
actions?: CardData[
|
|
362
|
+
actions?: CardData["actions"];
|
|
290
363
|
}): CardData;
|
|
291
364
|
/**
|
|
292
365
|
* Table helper options
|
|
@@ -294,14 +367,14 @@ declare function createCard(id: string, title: string, description?: string, opt
|
|
|
294
367
|
interface TableHelperOptions {
|
|
295
368
|
title?: string;
|
|
296
369
|
description?: string;
|
|
297
|
-
layout?:
|
|
370
|
+
layout?: "inline" | "artifact";
|
|
298
371
|
sortable?: boolean;
|
|
299
372
|
filterable?: boolean;
|
|
300
373
|
pagination?: {
|
|
301
374
|
pageSize?: number;
|
|
302
375
|
pageSizeOptions?: number[];
|
|
303
376
|
};
|
|
304
|
-
density?:
|
|
377
|
+
density?: "comfortable" | "compact";
|
|
305
378
|
}
|
|
306
379
|
/**
|
|
307
380
|
* Create a table specification
|
|
@@ -313,8 +386,8 @@ declare function createTable(data: Record<string, any>[], columns: TableColumn[]
|
|
|
313
386
|
declare function createColumn(key: string, header: string, options?: {
|
|
314
387
|
width?: number | string;
|
|
315
388
|
sortable?: boolean;
|
|
316
|
-
cellType?:
|
|
317
|
-
format?: TableColumn[
|
|
389
|
+
cellType?: "text" | "number" | "date" | "badge" | "link";
|
|
390
|
+
format?: TableColumn["format"];
|
|
318
391
|
}): TableColumn;
|
|
319
392
|
/**
|
|
320
393
|
* Create a markdown specification
|
|
@@ -322,7 +395,7 @@ declare function createColumn(key: string, header: string, options?: {
|
|
|
322
395
|
declare function createMarkdown(content: string, options?: {
|
|
323
396
|
title?: string;
|
|
324
397
|
description?: string;
|
|
325
|
-
layout?:
|
|
398
|
+
layout?: "inline" | "artifact";
|
|
326
399
|
syntaxHighlight?: boolean;
|
|
327
400
|
}): MarkdownComponentSpec;
|
|
328
401
|
/**
|
|
@@ -331,7 +404,7 @@ declare function createMarkdown(content: string, options?: {
|
|
|
331
404
|
declare function createArtifact(content: UIComponentSpec[], options?: {
|
|
332
405
|
title?: string;
|
|
333
406
|
description?: string;
|
|
334
|
-
variant?:
|
|
407
|
+
variant?: "default" | "bordered" | "elevated";
|
|
335
408
|
}): ArtifactComponentSpec;
|
|
336
409
|
/**
|
|
337
410
|
* Smart chart creator - automatically chooses the best chart type based on data
|
|
@@ -339,10 +412,10 @@ declare function createArtifact(content: UIComponentSpec[], options?: {
|
|
|
339
412
|
declare function createSmartChart(data: any[], options?: {
|
|
340
413
|
title?: string;
|
|
341
414
|
description?: string;
|
|
342
|
-
layout?:
|
|
415
|
+
layout?: "inline" | "artifact";
|
|
343
416
|
xKey?: string;
|
|
344
417
|
yKeys?: string[];
|
|
345
|
-
preferredType?:
|
|
418
|
+
preferredType?: "bar" | "line" | "area" | "pie";
|
|
346
419
|
}): ChartComponentSpec;
|
|
347
420
|
/**
|
|
348
421
|
* Wrap data and UI into a ToolHandlerResult
|
|
@@ -369,62 +442,4 @@ declare function resultWithCardGrid(cards: CardData[], options?: CardGridHelperO
|
|
|
369
442
|
*/
|
|
370
443
|
declare function resultWithTable(data: Record<string, any>[], columns: TableColumn[], options?: TableHelperOptions): ToolHandlerResult;
|
|
371
444
|
|
|
372
|
-
|
|
373
|
-
* Main hook for chat interactions
|
|
374
|
-
* Provides messages, state, and methods to interact with the agent
|
|
375
|
-
*/
|
|
376
|
-
declare function useAgnoChat(): {
|
|
377
|
-
messages: ChatMessage[];
|
|
378
|
-
sendMessage: (message: string | FormData, options?: {
|
|
379
|
-
headers?: Record<string, string>;
|
|
380
|
-
params?: Record<string, string>;
|
|
381
|
-
}) => Promise<void>;
|
|
382
|
-
clearMessages: () => void;
|
|
383
|
-
isStreaming: boolean;
|
|
384
|
-
isRefreshing: boolean;
|
|
385
|
-
isPaused: boolean;
|
|
386
|
-
error: string | undefined;
|
|
387
|
-
state: ClientState;
|
|
388
|
-
};
|
|
389
|
-
|
|
390
|
-
/**
|
|
391
|
-
* Hook for session management
|
|
392
|
-
*/
|
|
393
|
-
declare function useAgnoSession(): {
|
|
394
|
-
sessions: SessionEntry[];
|
|
395
|
-
currentSessionId: string | undefined;
|
|
396
|
-
loadSession: (sessionId: string, options?: {
|
|
397
|
-
params?: Record<string, string>;
|
|
398
|
-
}) => Promise<ChatMessage[]>;
|
|
399
|
-
fetchSessions: (options?: {
|
|
400
|
-
params?: Record<string, string>;
|
|
401
|
-
}) => Promise<SessionEntry[]>;
|
|
402
|
-
isLoading: boolean;
|
|
403
|
-
error: string | undefined;
|
|
404
|
-
};
|
|
405
|
-
|
|
406
|
-
/**
|
|
407
|
-
* Hook for common actions like initialization, fetching agents/teams
|
|
408
|
-
*/
|
|
409
|
-
declare function useAgnoActions(): {
|
|
410
|
-
initialize: (options?: {
|
|
411
|
-
params?: Record<string, string>;
|
|
412
|
-
}) => Promise<{
|
|
413
|
-
agents: AgentDetails[];
|
|
414
|
-
teams: TeamDetails[];
|
|
415
|
-
}>;
|
|
416
|
-
checkStatus: (options?: {
|
|
417
|
-
params?: Record<string, string>;
|
|
418
|
-
}) => Promise<boolean>;
|
|
419
|
-
fetchAgents: (options?: {
|
|
420
|
-
params?: Record<string, string>;
|
|
421
|
-
}) => Promise<AgentDetails[]>;
|
|
422
|
-
fetchTeams: (options?: {
|
|
423
|
-
params?: Record<string, string>;
|
|
424
|
-
}) => Promise<TeamDetails[]>;
|
|
425
|
-
updateConfig: (updates: Partial<Parameters<(updates: Partial<_antipopp_agno_types.AgnoClientConfig>) => void>[0]>) => void;
|
|
426
|
-
isInitializing: boolean;
|
|
427
|
-
error: string | undefined;
|
|
428
|
-
};
|
|
429
|
-
|
|
430
|
-
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 };
|
|
445
|
+
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, clearCustomRenderRegistry, 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
|
@@ -1,16 +1,37 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { AgnoClient } from '@antipopp/agno-client';
|
|
4
1
|
import * as _antipopp_agno_types from '@antipopp/agno-types';
|
|
5
|
-
import { AgnoClientConfig, ToolCall, CustomRenderFunction,
|
|
2
|
+
import { UIComponentSpec, AgnoClientConfig, ToolCall, CustomRenderFunction, AgentDetails, TeamDetails, ChatMessage, ClientState, SessionEntry, ChartComponentSpec, ArtifactComponentSpec, CardData, CardGridComponentSpec, TableColumn, MarkdownComponentSpec, TableComponentSpec, ToolHandlerResult } from '@antipopp/agno-types';
|
|
6
3
|
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';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
|
+
import { AgnoClient } from '@antipopp/agno-client';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Generative UI Renderer
|
|
10
|
+
*
|
|
11
|
+
* Renders UI components based on specifications from the agent.
|
|
12
|
+
* Supports both registry-based components and custom render functions.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
interface GenerativeUIRendererProps {
|
|
16
|
+
/** The UI component specification to render */
|
|
17
|
+
spec: UIComponentSpec;
|
|
18
|
+
/** Optional className for styling */
|
|
19
|
+
className?: string;
|
|
20
|
+
/** Error boundary fallback */
|
|
21
|
+
onError?: (error: Error) => void;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Main Generative UI Renderer component
|
|
25
|
+
*/
|
|
26
|
+
declare function GenerativeUIRenderer({ spec, className, onError, }: GenerativeUIRendererProps): React.ReactElement;
|
|
7
27
|
|
|
8
28
|
interface AgnoProviderProps {
|
|
9
29
|
config: AgnoClientConfig;
|
|
10
30
|
children: React.ReactNode;
|
|
11
31
|
}
|
|
12
32
|
/**
|
|
13
|
-
* Provider component that creates and manages an AgnoClient instance
|
|
33
|
+
* Provider component that creates and manages an AgnoClient instance.
|
|
34
|
+
* Handles cleanup of all module-level registries on unmount to prevent memory leaks.
|
|
14
35
|
*/
|
|
15
36
|
declare function AgnoProvider({ config, children }: AgnoProviderProps): react_jsx_runtime.JSX.Element;
|
|
16
37
|
/**
|
|
@@ -26,6 +47,11 @@ type ToolHandler = (args: Record<string, any>) => Promise<any>;
|
|
|
26
47
|
* Get a custom render function by key
|
|
27
48
|
*/
|
|
28
49
|
declare function getCustomRender(key: string): CustomRenderFunction | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Clear all custom render functions from the registry.
|
|
52
|
+
* Call this during cleanup (e.g., when AgnoProvider unmounts) to prevent memory leaks.
|
|
53
|
+
*/
|
|
54
|
+
declare function clearCustomRenderRegistry(): void;
|
|
29
55
|
/**
|
|
30
56
|
* Tool execution event payload
|
|
31
57
|
*/
|
|
@@ -108,7 +134,7 @@ interface ToolHandlerProviderProps {
|
|
|
108
134
|
* </ToolHandlerProvider>
|
|
109
135
|
* ```
|
|
110
136
|
*/
|
|
111
|
-
declare function ToolHandlerProvider({ handlers: initialHandlers, children }: ToolHandlerProviderProps): react_jsx_runtime.JSX.Element;
|
|
137
|
+
declare function ToolHandlerProvider({ handlers: initialHandlers, children, }: ToolHandlerProviderProps): react_jsx_runtime.JSX.Element;
|
|
112
138
|
/**
|
|
113
139
|
* Hook to access global tool handlers
|
|
114
140
|
*
|
|
@@ -122,24 +148,65 @@ declare function ToolHandlerProvider({ handlers: initialHandlers, children }: To
|
|
|
122
148
|
declare function useToolHandlers(): ToolHandlerContextValue | null;
|
|
123
149
|
|
|
124
150
|
/**
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
* Renders UI components based on specifications from the agent.
|
|
128
|
-
* Supports both registry-based components and custom render functions.
|
|
151
|
+
* Hook for common actions like initialization, fetching agents/teams
|
|
129
152
|
*/
|
|
153
|
+
declare function useAgnoActions(): {
|
|
154
|
+
initialize: (options?: {
|
|
155
|
+
params?: Record<string, string>;
|
|
156
|
+
}) => Promise<{
|
|
157
|
+
agents: AgentDetails[];
|
|
158
|
+
teams: TeamDetails[];
|
|
159
|
+
}>;
|
|
160
|
+
checkStatus: (options?: {
|
|
161
|
+
params?: Record<string, string>;
|
|
162
|
+
}) => Promise<boolean>;
|
|
163
|
+
fetchAgents: (options?: {
|
|
164
|
+
params?: Record<string, string>;
|
|
165
|
+
}) => Promise<AgentDetails[]>;
|
|
166
|
+
fetchTeams: (options?: {
|
|
167
|
+
params?: Record<string, string>;
|
|
168
|
+
}) => Promise<TeamDetails[]>;
|
|
169
|
+
updateConfig: (updates: Partial<Parameters<(updates: Partial<_antipopp_agno_types.AgnoClientConfig>) => void>[0]>) => void;
|
|
170
|
+
isInitializing: boolean;
|
|
171
|
+
error: string | undefined;
|
|
172
|
+
};
|
|
130
173
|
|
|
131
|
-
interface GenerativeUIRendererProps {
|
|
132
|
-
/** The UI component specification to render */
|
|
133
|
-
spec: UIComponentSpec;
|
|
134
|
-
/** Optional className for styling */
|
|
135
|
-
className?: string;
|
|
136
|
-
/** Error boundary fallback */
|
|
137
|
-
onError?: (error: Error) => void;
|
|
138
|
-
}
|
|
139
174
|
/**
|
|
140
|
-
* Main
|
|
175
|
+
* Main hook for chat interactions
|
|
176
|
+
* Provides messages, state, and methods to interact with the agent
|
|
141
177
|
*/
|
|
142
|
-
declare function
|
|
178
|
+
declare function useAgnoChat(): {
|
|
179
|
+
messages: ChatMessage[];
|
|
180
|
+
sendMessage: (message: string | FormData, options?: {
|
|
181
|
+
headers?: Record<string, string>;
|
|
182
|
+
params?: Record<string, string>;
|
|
183
|
+
}) => Promise<void>;
|
|
184
|
+
clearMessages: () => void;
|
|
185
|
+
cancelRun: () => Promise<void>;
|
|
186
|
+
isStreaming: boolean;
|
|
187
|
+
isRefreshing: boolean;
|
|
188
|
+
isPaused: boolean;
|
|
189
|
+
isCancelling: boolean;
|
|
190
|
+
currentRunId: string | undefined;
|
|
191
|
+
error: string | undefined;
|
|
192
|
+
state: ClientState;
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Hook for session management
|
|
197
|
+
*/
|
|
198
|
+
declare function useAgnoSession(): {
|
|
199
|
+
sessions: SessionEntry[];
|
|
200
|
+
currentSessionId: string | undefined;
|
|
201
|
+
loadSession: (sessionId: string, options?: {
|
|
202
|
+
params?: Record<string, string>;
|
|
203
|
+
}) => Promise<ChatMessage[]>;
|
|
204
|
+
fetchSessions: (options?: {
|
|
205
|
+
params?: Record<string, string>;
|
|
206
|
+
}) => Promise<SessionEntry[]>;
|
|
207
|
+
isLoading: boolean;
|
|
208
|
+
error: string | undefined;
|
|
209
|
+
};
|
|
143
210
|
|
|
144
211
|
/**
|
|
145
212
|
* Component Registry for Generative UI
|
|
@@ -156,7 +223,7 @@ type ComponentRenderer = (props: any) => any;
|
|
|
156
223
|
*/
|
|
157
224
|
declare class ComponentRegistry {
|
|
158
225
|
private static instance;
|
|
159
|
-
private components;
|
|
226
|
+
private readonly components;
|
|
160
227
|
private constructor();
|
|
161
228
|
/**
|
|
162
229
|
* Get the singleton instance
|
|
@@ -190,6 +257,12 @@ declare class ComponentRegistry {
|
|
|
190
257
|
* Clear all registered components
|
|
191
258
|
*/
|
|
192
259
|
clear(): void;
|
|
260
|
+
/**
|
|
261
|
+
* Reset the singleton instance.
|
|
262
|
+
* Call this during cleanup (e.g., when AgnoProvider unmounts) to prevent memory leaks.
|
|
263
|
+
* After calling this, getInstance() will create a fresh instance.
|
|
264
|
+
*/
|
|
265
|
+
static resetInstance(): void;
|
|
193
266
|
}
|
|
194
267
|
/**
|
|
195
268
|
* Get the global component registry instance
|
|
@@ -220,7 +293,7 @@ interface ChartHelperOptions {
|
|
|
220
293
|
/** Chart description */
|
|
221
294
|
description?: string;
|
|
222
295
|
/** Layout preference */
|
|
223
|
-
layout?:
|
|
296
|
+
layout?: "inline" | "artifact";
|
|
224
297
|
/** Show legend */
|
|
225
298
|
showLegend?: boolean;
|
|
226
299
|
/** Show grid */
|
|
@@ -266,7 +339,7 @@ declare function createAreaChart(data: any[], xKey: string, areas: Array<{
|
|
|
266
339
|
interface CardGridHelperOptions {
|
|
267
340
|
title?: string;
|
|
268
341
|
description?: string;
|
|
269
|
-
layout?:
|
|
342
|
+
layout?: "inline" | "artifact";
|
|
270
343
|
columns?: {
|
|
271
344
|
default?: number;
|
|
272
345
|
sm?: number;
|
|
@@ -274,7 +347,7 @@ interface CardGridHelperOptions {
|
|
|
274
347
|
lg?: number;
|
|
275
348
|
xl?: number;
|
|
276
349
|
};
|
|
277
|
-
variant?:
|
|
350
|
+
variant?: "default" | "bordered" | "elevated";
|
|
278
351
|
}
|
|
279
352
|
/**
|
|
280
353
|
* Create a card grid specification
|
|
@@ -286,7 +359,7 @@ declare function createCardGrid(cards: CardData[], options?: CardGridHelperOptio
|
|
|
286
359
|
declare function createCard(id: string, title: string, description?: string, options?: {
|
|
287
360
|
image?: string;
|
|
288
361
|
metadata?: Record<string, any>;
|
|
289
|
-
actions?: CardData[
|
|
362
|
+
actions?: CardData["actions"];
|
|
290
363
|
}): CardData;
|
|
291
364
|
/**
|
|
292
365
|
* Table helper options
|
|
@@ -294,14 +367,14 @@ declare function createCard(id: string, title: string, description?: string, opt
|
|
|
294
367
|
interface TableHelperOptions {
|
|
295
368
|
title?: string;
|
|
296
369
|
description?: string;
|
|
297
|
-
layout?:
|
|
370
|
+
layout?: "inline" | "artifact";
|
|
298
371
|
sortable?: boolean;
|
|
299
372
|
filterable?: boolean;
|
|
300
373
|
pagination?: {
|
|
301
374
|
pageSize?: number;
|
|
302
375
|
pageSizeOptions?: number[];
|
|
303
376
|
};
|
|
304
|
-
density?:
|
|
377
|
+
density?: "comfortable" | "compact";
|
|
305
378
|
}
|
|
306
379
|
/**
|
|
307
380
|
* Create a table specification
|
|
@@ -313,8 +386,8 @@ declare function createTable(data: Record<string, any>[], columns: TableColumn[]
|
|
|
313
386
|
declare function createColumn(key: string, header: string, options?: {
|
|
314
387
|
width?: number | string;
|
|
315
388
|
sortable?: boolean;
|
|
316
|
-
cellType?:
|
|
317
|
-
format?: TableColumn[
|
|
389
|
+
cellType?: "text" | "number" | "date" | "badge" | "link";
|
|
390
|
+
format?: TableColumn["format"];
|
|
318
391
|
}): TableColumn;
|
|
319
392
|
/**
|
|
320
393
|
* Create a markdown specification
|
|
@@ -322,7 +395,7 @@ declare function createColumn(key: string, header: string, options?: {
|
|
|
322
395
|
declare function createMarkdown(content: string, options?: {
|
|
323
396
|
title?: string;
|
|
324
397
|
description?: string;
|
|
325
|
-
layout?:
|
|
398
|
+
layout?: "inline" | "artifact";
|
|
326
399
|
syntaxHighlight?: boolean;
|
|
327
400
|
}): MarkdownComponentSpec;
|
|
328
401
|
/**
|
|
@@ -331,7 +404,7 @@ declare function createMarkdown(content: string, options?: {
|
|
|
331
404
|
declare function createArtifact(content: UIComponentSpec[], options?: {
|
|
332
405
|
title?: string;
|
|
333
406
|
description?: string;
|
|
334
|
-
variant?:
|
|
407
|
+
variant?: "default" | "bordered" | "elevated";
|
|
335
408
|
}): ArtifactComponentSpec;
|
|
336
409
|
/**
|
|
337
410
|
* Smart chart creator - automatically chooses the best chart type based on data
|
|
@@ -339,10 +412,10 @@ declare function createArtifact(content: UIComponentSpec[], options?: {
|
|
|
339
412
|
declare function createSmartChart(data: any[], options?: {
|
|
340
413
|
title?: string;
|
|
341
414
|
description?: string;
|
|
342
|
-
layout?:
|
|
415
|
+
layout?: "inline" | "artifact";
|
|
343
416
|
xKey?: string;
|
|
344
417
|
yKeys?: string[];
|
|
345
|
-
preferredType?:
|
|
418
|
+
preferredType?: "bar" | "line" | "area" | "pie";
|
|
346
419
|
}): ChartComponentSpec;
|
|
347
420
|
/**
|
|
348
421
|
* Wrap data and UI into a ToolHandlerResult
|
|
@@ -369,62 +442,4 @@ declare function resultWithCardGrid(cards: CardData[], options?: CardGridHelperO
|
|
|
369
442
|
*/
|
|
370
443
|
declare function resultWithTable(data: Record<string, any>[], columns: TableColumn[], options?: TableHelperOptions): ToolHandlerResult;
|
|
371
444
|
|
|
372
|
-
|
|
373
|
-
* Main hook for chat interactions
|
|
374
|
-
* Provides messages, state, and methods to interact with the agent
|
|
375
|
-
*/
|
|
376
|
-
declare function useAgnoChat(): {
|
|
377
|
-
messages: ChatMessage[];
|
|
378
|
-
sendMessage: (message: string | FormData, options?: {
|
|
379
|
-
headers?: Record<string, string>;
|
|
380
|
-
params?: Record<string, string>;
|
|
381
|
-
}) => Promise<void>;
|
|
382
|
-
clearMessages: () => void;
|
|
383
|
-
isStreaming: boolean;
|
|
384
|
-
isRefreshing: boolean;
|
|
385
|
-
isPaused: boolean;
|
|
386
|
-
error: string | undefined;
|
|
387
|
-
state: ClientState;
|
|
388
|
-
};
|
|
389
|
-
|
|
390
|
-
/**
|
|
391
|
-
* Hook for session management
|
|
392
|
-
*/
|
|
393
|
-
declare function useAgnoSession(): {
|
|
394
|
-
sessions: SessionEntry[];
|
|
395
|
-
currentSessionId: string | undefined;
|
|
396
|
-
loadSession: (sessionId: string, options?: {
|
|
397
|
-
params?: Record<string, string>;
|
|
398
|
-
}) => Promise<ChatMessage[]>;
|
|
399
|
-
fetchSessions: (options?: {
|
|
400
|
-
params?: Record<string, string>;
|
|
401
|
-
}) => Promise<SessionEntry[]>;
|
|
402
|
-
isLoading: boolean;
|
|
403
|
-
error: string | undefined;
|
|
404
|
-
};
|
|
405
|
-
|
|
406
|
-
/**
|
|
407
|
-
* Hook for common actions like initialization, fetching agents/teams
|
|
408
|
-
*/
|
|
409
|
-
declare function useAgnoActions(): {
|
|
410
|
-
initialize: (options?: {
|
|
411
|
-
params?: Record<string, string>;
|
|
412
|
-
}) => Promise<{
|
|
413
|
-
agents: AgentDetails[];
|
|
414
|
-
teams: TeamDetails[];
|
|
415
|
-
}>;
|
|
416
|
-
checkStatus: (options?: {
|
|
417
|
-
params?: Record<string, string>;
|
|
418
|
-
}) => Promise<boolean>;
|
|
419
|
-
fetchAgents: (options?: {
|
|
420
|
-
params?: Record<string, string>;
|
|
421
|
-
}) => Promise<AgentDetails[]>;
|
|
422
|
-
fetchTeams: (options?: {
|
|
423
|
-
params?: Record<string, string>;
|
|
424
|
-
}) => Promise<TeamDetails[]>;
|
|
425
|
-
updateConfig: (updates: Partial<Parameters<(updates: Partial<_antipopp_agno_types.AgnoClientConfig>) => void>[0]>) => void;
|
|
426
|
-
isInitializing: boolean;
|
|
427
|
-
error: string | undefined;
|
|
428
|
-
};
|
|
429
|
-
|
|
430
|
-
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 };
|
|
445
|
+
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, clearCustomRenderRegistry, 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 };
|