@rodrigocoliveira/agno-react 1.0.2 → 1.0.3

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.
Files changed (159) hide show
  1. package/README.md +2 -2
  2. package/dist/components/GenerativeUIRenderer.d.ts +21 -0
  3. package/dist/components/GenerativeUIRenderer.d.ts.map +1 -0
  4. package/dist/context/AgnoContext.d.ts +16 -0
  5. package/dist/context/AgnoContext.d.ts.map +1 -0
  6. package/dist/context/ToolHandlerContext.d.ts +44 -0
  7. package/dist/context/ToolHandlerContext.d.ts.map +1 -0
  8. package/dist/hooks/useAgnoActions.d.ts +25 -0
  9. package/dist/hooks/useAgnoActions.d.ts.map +1 -0
  10. package/dist/hooks/useAgnoChat.d.ts +22 -0
  11. package/dist/hooks/useAgnoChat.d.ts.map +1 -0
  12. package/dist/hooks/useAgnoCustomEvents.d.ts +38 -0
  13. package/dist/hooks/useAgnoCustomEvents.d.ts.map +1 -0
  14. package/dist/hooks/useAgnoEvals.d.ts +39 -0
  15. package/dist/hooks/useAgnoEvals.d.ts.map +1 -0
  16. package/dist/hooks/useAgnoKnowledge.d.ts +56 -0
  17. package/dist/hooks/useAgnoKnowledge.d.ts.map +1 -0
  18. package/dist/hooks/useAgnoMemory.d.ts +42 -0
  19. package/dist/hooks/useAgnoMemory.d.ts.map +1 -0
  20. package/dist/hooks/useAgnoMetrics.d.ts +51 -0
  21. package/dist/hooks/useAgnoMetrics.d.ts.map +1 -0
  22. package/dist/hooks/useAgnoSession.d.ts +38 -0
  23. package/dist/hooks/useAgnoSession.d.ts.map +1 -0
  24. package/dist/hooks/useAgnoToolExecution.d.ts +70 -0
  25. package/dist/hooks/useAgnoToolExecution.d.ts.map +1 -0
  26. package/dist/hooks/useAgnoTraces.d.ts +51 -0
  27. package/dist/hooks/useAgnoTraces.d.ts.map +1 -0
  28. package/dist/index.d.ts +27 -723
  29. package/dist/index.d.ts.map +1 -0
  30. package/dist/index.js +932 -1052
  31. package/dist/index.js.map +24 -0
  32. package/dist/index.mjs +816 -909
  33. package/dist/index.mjs.map +24 -0
  34. package/dist/ui/components/artifact.d.ts +24 -0
  35. package/dist/ui/components/artifact.d.ts.map +1 -0
  36. package/dist/ui/components/audio-recorder.d.ts +32 -0
  37. package/dist/ui/components/audio-recorder.d.ts.map +1 -0
  38. package/dist/ui/components/code-block.d.ts +15 -0
  39. package/dist/ui/components/code-block.d.ts.map +1 -0
  40. package/dist/ui/components/conversation.d.ts +17 -0
  41. package/dist/ui/components/conversation.d.ts.map +1 -0
  42. package/dist/ui/components/file-preview-card.d.ts +13 -0
  43. package/dist/ui/components/file-preview-card.d.ts.map +1 -0
  44. package/dist/ui/components/file-preview-modal.d.ts +8 -0
  45. package/dist/ui/components/file-preview-modal.d.ts.map +1 -0
  46. package/dist/ui/components/image-lightbox.d.ts +12 -0
  47. package/dist/ui/components/image-lightbox.d.ts.map +1 -0
  48. package/dist/ui/components/message.d.ts +19 -0
  49. package/dist/ui/components/message.d.ts.map +1 -0
  50. package/dist/ui/components/prompt-input/attachments.d.ts +21 -0
  51. package/dist/ui/components/prompt-input/attachments.d.ts.map +1 -0
  52. package/dist/ui/components/prompt-input/buttons.d.ts +19 -0
  53. package/dist/ui/components/prompt-input/buttons.d.ts.map +1 -0
  54. package/dist/ui/components/prompt-input/command.d.ts +17 -0
  55. package/dist/ui/components/prompt-input/command.d.ts.map +1 -0
  56. package/dist/ui/components/prompt-input/context.d.ts +36 -0
  57. package/dist/ui/components/prompt-input/context.d.ts.map +1 -0
  58. package/dist/ui/components/prompt-input/drop-zone.d.ts +7 -0
  59. package/dist/ui/components/prompt-input/drop-zone.d.ts.map +1 -0
  60. package/dist/ui/components/prompt-input/footer.d.ts +11 -0
  61. package/dist/ui/components/prompt-input/footer.d.ts.map +1 -0
  62. package/dist/ui/components/prompt-input/index.d.ts +25 -0
  63. package/dist/ui/components/prompt-input/index.d.ts.map +1 -0
  64. package/dist/ui/components/prompt-input/model-select.d.ts +13 -0
  65. package/dist/ui/components/prompt-input/model-select.d.ts.map +1 -0
  66. package/dist/ui/components/prompt-input/prompt-input.d.ts +22 -0
  67. package/dist/ui/components/prompt-input/prompt-input.d.ts.map +1 -0
  68. package/dist/ui/components/prompt-input/provider.d.ts +6 -0
  69. package/dist/ui/components/prompt-input/provider.d.ts.map +1 -0
  70. package/dist/ui/components/prompt-input/speech.d.ts +51 -0
  71. package/dist/ui/components/prompt-input/speech.d.ts.map +1 -0
  72. package/dist/ui/components/prompt-input/tabs.d.ts +12 -0
  73. package/dist/ui/components/prompt-input/tabs.d.ts.map +1 -0
  74. package/dist/ui/components/prompt-input/textarea.d.ts +5 -0
  75. package/dist/ui/components/prompt-input/textarea.d.ts.map +1 -0
  76. package/dist/ui/components/response.d.ts +5 -0
  77. package/dist/ui/components/response.d.ts.map +1 -0
  78. package/dist/ui/components/smart-timestamp.d.ts +8 -0
  79. package/dist/ui/components/smart-timestamp.d.ts.map +1 -0
  80. package/dist/ui/components/streaming-indicator.d.ts +8 -0
  81. package/dist/ui/components/streaming-indicator.d.ts.map +1 -0
  82. package/dist/ui/components/tool.d.ts +24 -0
  83. package/dist/ui/components/tool.d.ts.map +1 -0
  84. package/dist/ui/composed/AgnoChatInput.d.ts +44 -0
  85. package/dist/ui/composed/AgnoChatInput.d.ts.map +1 -0
  86. package/dist/ui/composed/AgnoChatInterface.d.ts +49 -0
  87. package/dist/ui/composed/AgnoChatInterface.d.ts.map +1 -0
  88. package/dist/ui/composed/AgnoMessageItem.d.ts +38 -0
  89. package/dist/ui/composed/AgnoMessageItem.d.ts.map +1 -0
  90. package/dist/ui/composed/agno-chat/agno-chat.d.ts +9 -0
  91. package/dist/ui/composed/agno-chat/agno-chat.d.ts.map +1 -0
  92. package/dist/ui/composed/agno-chat/context.d.ts +33 -0
  93. package/dist/ui/composed/agno-chat/context.d.ts.map +1 -0
  94. package/dist/ui/composed/agno-chat/empty-state.d.ts +6 -0
  95. package/dist/ui/composed/agno-chat/empty-state.d.ts.map +1 -0
  96. package/dist/ui/composed/agno-chat/error-bar.d.ts +5 -0
  97. package/dist/ui/composed/agno-chat/error-bar.d.ts.map +1 -0
  98. package/dist/ui/composed/agno-chat/index.d.ts +33 -0
  99. package/dist/ui/composed/agno-chat/index.d.ts.map +1 -0
  100. package/dist/ui/composed/agno-chat/input.d.ts +39 -0
  101. package/dist/ui/composed/agno-chat/input.d.ts.map +1 -0
  102. package/dist/ui/composed/agno-chat/messages.d.ts +21 -0
  103. package/dist/ui/composed/agno-chat/messages.d.ts.map +1 -0
  104. package/dist/ui/composed/agno-chat/suggested-prompts.d.ts +7 -0
  105. package/dist/ui/composed/agno-chat/suggested-prompts.d.ts.map +1 -0
  106. package/dist/ui/composed/agno-chat/tool-status.d.ts +5 -0
  107. package/dist/ui/composed/agno-chat/tool-status.d.ts.map +1 -0
  108. package/dist/ui/composed/index.d.ts +9 -0
  109. package/dist/ui/composed/index.d.ts.map +1 -0
  110. package/dist/ui/index.d.ts +59 -0
  111. package/dist/ui/index.d.ts.map +1 -0
  112. package/dist/ui/lib/cn.d.ts +3 -0
  113. package/dist/ui/lib/cn.d.ts.map +1 -0
  114. package/dist/ui/lib/file-utils.d.ts +20 -0
  115. package/dist/ui/lib/file-utils.d.ts.map +1 -0
  116. package/dist/ui/lib/format-timestamp.d.ts +16 -0
  117. package/dist/ui/lib/format-timestamp.d.ts.map +1 -0
  118. package/dist/ui/primitives/accordion.d.ts +8 -0
  119. package/dist/ui/primitives/accordion.d.ts.map +1 -0
  120. package/dist/ui/primitives/avatar.d.ts +7 -0
  121. package/dist/ui/primitives/avatar.d.ts.map +1 -0
  122. package/dist/ui/primitives/badge.d.ts +10 -0
  123. package/dist/ui/primitives/badge.d.ts.map +1 -0
  124. package/dist/ui/primitives/button.d.ts +12 -0
  125. package/dist/ui/primitives/button.d.ts.map +1 -0
  126. package/dist/ui/primitives/collapsible.d.ts +6 -0
  127. package/dist/ui/primitives/collapsible.d.ts.map +1 -0
  128. package/dist/ui/primitives/command.d.ts +79 -0
  129. package/dist/ui/primitives/command.d.ts.map +1 -0
  130. package/dist/ui/primitives/dialog.d.ts +26 -0
  131. package/dist/ui/primitives/dialog.d.ts.map +1 -0
  132. package/dist/ui/primitives/dropdown-menu.d.ts +28 -0
  133. package/dist/ui/primitives/dropdown-menu.d.ts.map +1 -0
  134. package/dist/ui/primitives/hover-card.d.ts +7 -0
  135. package/dist/ui/primitives/hover-card.d.ts.map +1 -0
  136. package/dist/ui/primitives/index.d.ts +16 -0
  137. package/dist/ui/primitives/index.d.ts.map +1 -0
  138. package/dist/ui/primitives/input-group.d.ts +17 -0
  139. package/dist/ui/primitives/input-group.d.ts.map +1 -0
  140. package/dist/ui/primitives/select.d.ts +14 -0
  141. package/dist/ui/primitives/select.d.ts.map +1 -0
  142. package/dist/ui/primitives/tooltip.d.ts +8 -0
  143. package/dist/ui/primitives/tooltip.d.ts.map +1 -0
  144. package/dist/ui/types.d.ts +56 -0
  145. package/dist/ui/types.d.ts.map +1 -0
  146. package/dist/ui.d.ts +2 -891
  147. package/dist/ui.d.ts.map +1 -0
  148. package/dist/ui.js +2757 -2323
  149. package/dist/ui.js.map +60 -0
  150. package/dist/ui.mjs +2644 -2055
  151. package/dist/ui.mjs.map +60 -0
  152. package/dist/utils/component-registry.d.ts +63 -0
  153. package/dist/utils/component-registry.d.ts.map +1 -0
  154. package/dist/utils/ui-helpers.d.ts +165 -0
  155. package/dist/utils/ui-helpers.d.ts.map +1 -0
  156. package/package.json +9 -10
  157. package/LICENSE +0 -21
  158. package/dist/index.d.mts +0 -724
  159. package/dist/ui.d.mts +0 -891
package/dist/index.d.ts CHANGED
@@ -1,724 +1,28 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import React from 'react';
3
- import { AgnoClient, PaginatedTracesResult, PaginatedTraceSessionStatsResult } from '@rodrigocoliveira/agno-client';
4
- export { PaginatedTraceSessionStatsResult, PaginatedTracesResult } from '@rodrigocoliveira/agno-client';
5
- import * as _rodrigocoliveira_agno_types from '@rodrigocoliveira/agno-types';
6
- import { AgnoClientConfig, ToolCall, CustomRenderFunction, UIComponentSpec, ChartComponentSpec, CardData, CardGridComponentSpec, TableColumn, TableComponentSpec, MarkdownComponentSpec, ArtifactComponentSpec, ToolHandlerResult, ChatMessage, ClientState, SessionEntry, AgentSessionDetailSchema, TeamSessionDetailSchema, RunSchema, TeamRunSchema, CreateSessionRequest, UpdateSessionRequest, AgentDetails, TeamDetails, CustomEventData, UserMemory, ListMemoriesParams, MemoriesListResponse, UserMemoryStatsParams, UserMemoryStatsResponse, CreateMemoryRequest, UpdateMemoryRequest, KnowledgeConfigResponse, ContentResponse, ContentListOptions, ContentListResponse, ContentStatusResponse, VectorSearchRequest, VectorSearchResponse, ContentUpdateRequest, MetricsResponse, MetricsOptions, RefreshMetricsOptions, DayAggregatedMetrics, EvalSchema, ListEvalRunsParams, EvalRunsListResponse, ExecuteEvalRequest, UpdateEvalRunRequest, TraceSummary, TraceSessionStats, ListTracesOptions, GetTraceOptions, TraceDetail, TraceNode, GetTraceSessionStatsOptions } from '@rodrigocoliveira/agno-types';
7
- export { AgentDetails, AgnoClientConfig, ArtifactComponentSpec, CardData, CardGridComponentSpec, ChartComponentSpec, ChartSeries, ChatMessage, ChunkerSchema, ClientState, ContentListOptions, ContentListResponse, ContentResponse, ContentStatus, ContentStatusResponse, ContentUpdateRequest, ContentUploadRequest, CreateMemoryRequest, CustomComponentSpec, CustomEventData, DayAggregatedMetrics, DeleteEvalRunsRequest, DeleteMultipleMemoriesRequest, EvalComponentType, EvalRunsListResponse, EvalSchema, EvalType, ExecuteEvalRequest, GenerativeUIData, GetTraceOptions, GetTraceSessionStatsOptions, KnowledgeConfigResponse, ListEvalRunsParams, ListMemoriesParams, ListTracesOptions, MarkdownComponentSpec, MemoriesListResponse, MetricsOptions, MetricsResponse, ModelMetrics, PaginationInfo, ReaderSchema, RefreshMetricsOptions, RunEvent, ScoringStrategy, SessionEntry, SortOrder, TableColumn, TableComponentSpec, TeamDetails, TokenMetrics, ToolCall, ToolHandlerResult, TraceDetail, TraceNode, TraceSessionStats, TraceSessionStatsResponse, TraceStatus, TraceSummary, TracesListResponse, UIComponentSpec, UpdateEvalRunRequest, UpdateMemoryRequest, UserMemory, UserMemoryStats, UserMemoryStatsParams, UserMemoryStatsResponse, VectorDbSchema, VectorSearchRequest, VectorSearchResponse, VectorSearchResult } from '@rodrigocoliveira/agno-types';
8
-
9
- interface AgnoProviderProps {
10
- config: AgnoClientConfig;
11
- children: React.ReactNode;
12
- }
13
1
  /**
14
- * Provider component that creates and manages an AgnoClient instance
15
- */
16
- declare function AgnoProvider({ config, children }: AgnoProviderProps): react_jsx_runtime.JSX.Element;
17
- /**
18
- * Hook to access the AgnoClient instance
19
- */
20
- declare function useAgnoClient(): AgnoClient;
21
-
22
- /**
23
- * Tool handler function type (now supports generative UI)
24
- */
25
- type ToolHandler = (args: Record<string, any>) => Promise<any>;
26
- /**
27
- * Get a custom render function by key
28
- */
29
- declare function getCustomRender(key: string): CustomRenderFunction | undefined;
30
- /**
31
- * Tool execution event payload
32
- */
33
- interface ToolExecutionEvent {
34
- runId?: string;
35
- sessionId?: string;
36
- tools: ToolCall[];
37
- }
38
- /**
39
- * Hook for handling frontend tool execution (HITL)
40
- *
41
- * **Note:** HITL (Human-in-the-Loop) frontend tool execution is only supported for agents.
42
- * Teams do not support the continue endpoint. This hook will log a warning and no-op if used with team mode.
43
- *
44
- * @param handlers - Map of tool names to handler functions (local handlers)
45
- * @param autoExecute - Whether to automatically execute tools when paused (default: true)
46
- *
47
- * @example
48
- * ```tsx
49
- * const toolHandlers = {
50
- * navigate_to_page: async (args) => {
51
- * window.location.href = args.url;
52
- * return { success: true };
53
- * },
54
- * fill_form: async (args) => {
55
- * document.querySelector(args.selector).value = args.value;
56
- * return { filled: true };
57
- * }
58
- * };
59
- *
60
- * const { isPaused, isExecuting, pendingTools } = useAgnoToolExecution(toolHandlers);
61
- * ```
62
- */
63
- declare function useAgnoToolExecution(handlers?: Record<string, ToolHandler>, autoExecute?: boolean): {
64
- /** Whether the run is currently paused awaiting tool execution */
65
- isPaused: boolean;
66
- /** Whether tools are currently being executed */
67
- isExecuting: boolean;
68
- /** Tools awaiting execution */
69
- pendingTools: ToolCall[];
70
- /** Execute all pending tools and continue the run */
71
- executeAndContinue: () => Promise<void>;
72
- /** Execute specific tools and return results without continuing */
73
- executeTools: (tools: ToolCall[]) => Promise<ToolCall[]>;
74
- /** Continue the run with manually provided tool results */
75
- continueWithResults: (tools: ToolCall[], options?: {
76
- headers?: Record<string, string>;
77
- params?: Record<string, string>;
78
- }) => Promise<void>;
79
- /** Error from tool execution, if any */
80
- executionError: string | undefined;
81
- };
82
-
83
- /**
84
- * Context value for tool handler registry
85
- */
86
- interface ToolHandlerContextValue {
87
- handlers: Record<string, ToolHandler>;
88
- registerHandler: (name: string, handler: ToolHandler) => void;
89
- unregisterHandler: (name: string) => void;
90
- }
91
- interface ToolHandlerProviderProps {
92
- handlers?: Record<string, ToolHandler>;
93
- children: React.ReactNode;
94
- }
95
- /**
96
- * Provider component that manages global tool handlers
97
- *
98
- * @example
99
- * ```tsx
100
- * const globalHandlers = {
101
- * fill_form: async (args) => {
102
- * // Implementation
103
- * return { success: true };
104
- * }
105
- * };
106
- *
107
- * <ToolHandlerProvider handlers={globalHandlers}>
108
- * <App />
109
- * </ToolHandlerProvider>
110
- * ```
111
- */
112
- declare function ToolHandlerProvider({ handlers: initialHandlers, children }: ToolHandlerProviderProps): react_jsx_runtime.JSX.Element;
113
- /**
114
- * Hook to access global tool handlers
115
- *
116
- * @returns Tool handler context value or null if not within ToolHandlerProvider
117
- *
118
- * @example
119
- * ```tsx
120
- * const { handlers, registerHandler } = useToolHandlers() || { handlers: {} };
121
- * ```
122
- */
123
- declare function useToolHandlers(): ToolHandlerContextValue | null;
124
-
125
- /**
126
- * Generative UI Renderer
127
- *
128
- * Renders UI components based on specifications from the agent.
129
- * Supports both registry-based components and custom render functions.
130
- */
131
-
132
- interface GenerativeUIRendererProps {
133
- /** The UI component specification to render */
134
- spec: UIComponentSpec;
135
- /** Optional className for styling */
136
- className?: string;
137
- /** Error boundary fallback */
138
- onError?: (error: Error) => void;
139
- }
140
- /**
141
- * Main Generative UI Renderer component
142
- */
143
- declare function GenerativeUIRenderer({ spec, className, onError, }: GenerativeUIRendererProps): React.ReactElement;
144
-
145
- /**
146
- * Component Registry for Generative UI
147
- *
148
- * Maps component specifications to actual React components.
149
- * Allows registering custom components at runtime.
150
- */
151
- /**
152
- * Component renderer function type
153
- */
154
- type ComponentRenderer = (props: any) => any;
155
- /**
156
- * Component registry class
157
- */
158
- declare class ComponentRegistry {
159
- private static instance;
160
- private components;
161
- private constructor();
162
- /**
163
- * Get the singleton instance
164
- */
165
- static getInstance(): ComponentRegistry;
166
- /**
167
- * Register a component renderer
168
- */
169
- register(type: string, renderer: ComponentRenderer): void;
170
- /**
171
- * Register multiple components at once
172
- */
173
- registerBatch(components: Record<string, ComponentRenderer>): void;
174
- /**
175
- * Get a registered component renderer
176
- */
177
- get(type: string): ComponentRenderer | undefined;
178
- /**
179
- * Check if a component is registered
180
- */
181
- has(type: string): boolean;
182
- /**
183
- * Unregister a component
184
- */
185
- unregister(type: string): void;
186
- /**
187
- * Get all registered component types
188
- */
189
- getRegisteredTypes(): string[];
190
- /**
191
- * Clear all registered components
192
- */
193
- clear(): void;
194
- }
195
- /**
196
- * Get the global component registry instance
197
- */
198
- declare function getComponentRegistry(): ComponentRegistry;
199
- /**
200
- * Helper to register a chart component
201
- */
202
- declare function registerChartComponent(name: string, renderer: ComponentRenderer): void;
203
- /**
204
- * Helper to get a chart component
205
- */
206
- declare function getChartComponent(name: string): ComponentRenderer | undefined;
207
-
208
- /**
209
- * Helper utilities for creating UI component specifications
210
- *
211
- * These helpers make it easy to create common UI patterns without
212
- * manually constructing the full specification object.
213
- */
214
-
215
- /**
216
- * Chart helper options
217
- */
218
- interface ChartHelperOptions {
219
- /** Chart title */
220
- title?: string;
221
- /** Chart description */
222
- description?: string;
223
- /** Layout preference */
224
- layout?: 'inline' | 'artifact';
225
- /** Show legend */
226
- showLegend?: boolean;
227
- /** Show grid */
228
- showGrid?: boolean;
229
- /** Chart height */
230
- height?: number | string;
231
- /** Chart width */
232
- width?: number | string;
233
- }
234
- /**
235
- * Create a bar chart specification
236
- */
237
- declare function createBarChart(data: any[], xKey: string, bars: Array<{
238
- key: string;
239
- label?: string;
240
- color?: string;
241
- }>, options?: ChartHelperOptions): ChartComponentSpec;
242
- /**
243
- * Create a line chart specification
244
- */
245
- declare function createLineChart(data: any[], xKey: string, lines: Array<{
246
- key: string;
247
- label?: string;
248
- color?: string;
249
- }>, options?: ChartHelperOptions): ChartComponentSpec;
250
- /**
251
- * Create a pie chart specification
252
- */
253
- declare function createPieChart(data: any[], dataKey: string, nameKey: string, options?: ChartHelperOptions & {
254
- showLabel?: boolean;
255
- }): ChartComponentSpec;
256
- /**
257
- * Create an area chart specification
258
- */
259
- declare function createAreaChart(data: any[], xKey: string, areas: Array<{
260
- key: string;
261
- label?: string;
262
- color?: string;
263
- }>, options?: ChartHelperOptions): ChartComponentSpec;
264
- /**
265
- * Card grid helper options
266
- */
267
- interface CardGridHelperOptions {
268
- title?: string;
269
- description?: string;
270
- layout?: 'inline' | 'artifact';
271
- columns?: {
272
- default?: number;
273
- sm?: number;
274
- md?: number;
275
- lg?: number;
276
- xl?: number;
277
- };
278
- variant?: 'default' | 'bordered' | 'elevated';
279
- }
280
- /**
281
- * Create a card grid specification
282
- */
283
- declare function createCardGrid(cards: CardData[], options?: CardGridHelperOptions): CardGridComponentSpec;
284
- /**
285
- * Create a simple card
286
- */
287
- declare function createCard(id: string, title: string, description?: string, options?: {
288
- image?: string;
289
- metadata?: Record<string, any>;
290
- actions?: CardData['actions'];
291
- }): CardData;
292
- /**
293
- * Table helper options
294
- */
295
- interface TableHelperOptions {
296
- title?: string;
297
- description?: string;
298
- layout?: 'inline' | 'artifact';
299
- sortable?: boolean;
300
- filterable?: boolean;
301
- pagination?: {
302
- pageSize?: number;
303
- pageSizeOptions?: number[];
304
- };
305
- density?: 'comfortable' | 'compact';
306
- }
307
- /**
308
- * Create a table specification
309
- */
310
- declare function createTable(data: Record<string, any>[], columns: TableColumn[], options?: TableHelperOptions): TableComponentSpec;
311
- /**
312
- * Create a table column definition
313
- */
314
- declare function createColumn(key: string, header: string, options?: {
315
- width?: number | string;
316
- sortable?: boolean;
317
- cellType?: 'text' | 'number' | 'date' | 'badge' | 'link';
318
- format?: TableColumn['format'];
319
- }): TableColumn;
320
- /**
321
- * Create a markdown specification
322
- */
323
- declare function createMarkdown(content: string, options?: {
324
- title?: string;
325
- description?: string;
326
- layout?: 'inline' | 'artifact';
327
- syntaxHighlight?: boolean;
328
- }): MarkdownComponentSpec;
329
- /**
330
- * Create an artifact container with multiple child components
331
- */
332
- declare function createArtifact(content: UIComponentSpec[], options?: {
333
- title?: string;
334
- description?: string;
335
- variant?: 'default' | 'bordered' | 'elevated';
336
- }): ArtifactComponentSpec;
337
- /**
338
- * Smart chart creator - automatically chooses the best chart type based on data
339
- */
340
- declare function createSmartChart(data: any[], options?: {
341
- title?: string;
342
- description?: string;
343
- layout?: 'inline' | 'artifact';
344
- xKey?: string;
345
- yKeys?: string[];
346
- preferredType?: 'bar' | 'line' | 'area' | 'pie';
347
- }): ChartComponentSpec;
348
- /**
349
- * Wrap data and UI into a ToolHandlerResult
350
- */
351
- declare function createToolResult(data: any, ui: UIComponentSpec): ToolHandlerResult;
352
- /**
353
- * Quick helper: create a tool result with a bar chart
354
- */
355
- declare function resultWithBarChart(data: any[], xKey: string, bars: Array<{
356
- key: string;
357
- label?: string;
358
- color?: string;
359
- }>, options?: ChartHelperOptions): ToolHandlerResult;
360
- /**
361
- * Quick helper: create a tool result with a smart chart
362
- */
363
- declare function resultWithSmartChart(data: any[], options?: Parameters<typeof createSmartChart>[1]): ToolHandlerResult;
364
- /**
365
- * Quick helper: create a tool result with a card grid
366
- */
367
- declare function resultWithCardGrid(cards: CardData[], options?: CardGridHelperOptions): ToolHandlerResult;
368
- /**
369
- * Quick helper: create a tool result with a table
370
- */
371
- declare function resultWithTable(data: Record<string, any>[], columns: TableColumn[], options?: TableHelperOptions): ToolHandlerResult;
372
-
373
- /**
374
- * Main hook for chat interactions
375
- * Provides messages, state, and methods to interact with the agent
376
- */
377
- declare function useAgnoChat(): {
378
- messages: ChatMessage[];
379
- sendMessage: (message: string | FormData, options?: {
380
- headers?: Record<string, string>;
381
- params?: Record<string, string>;
382
- }) => Promise<void>;
383
- clearMessages: () => void;
384
- cancelRun: () => Promise<void>;
385
- isStreaming: boolean;
386
- isRefreshing: boolean;
387
- isPaused: boolean;
388
- isCancelling: boolean | undefined;
389
- currentRunId: string | undefined;
390
- error: string | undefined;
391
- state: ClientState;
392
- };
393
-
394
- /**
395
- * Hook for session management
396
- */
397
- declare function useAgnoSession(): {
398
- sessions: SessionEntry[];
399
- currentSessionId: string | undefined;
400
- loadSession: (sessionId: string, options?: {
401
- params?: Record<string, string>;
402
- }) => Promise<ChatMessage[]>;
403
- fetchSessions: (options?: {
404
- params?: Record<string, string>;
405
- }) => Promise<SessionEntry[]>;
406
- getSessionById: (sessionId: string, options?: {
407
- params?: Record<string, string>;
408
- }) => Promise<AgentSessionDetailSchema | TeamSessionDetailSchema>;
409
- getRunById: (sessionId: string, runId: string, options?: {
410
- params?: Record<string, string>;
411
- }) => Promise<RunSchema | TeamRunSchema>;
412
- createSession: (request?: CreateSessionRequest, options?: {
413
- params?: Record<string, string>;
414
- }) => Promise<AgentSessionDetailSchema | TeamSessionDetailSchema>;
415
- updateSession: (sessionId: string, request: UpdateSessionRequest, options?: {
416
- params?: Record<string, string>;
417
- }) => Promise<AgentSessionDetailSchema | TeamSessionDetailSchema>;
418
- renameSession: (sessionId: string, newName: string, options?: {
419
- params?: Record<string, string>;
420
- }) => Promise<AgentSessionDetailSchema | TeamSessionDetailSchema>;
421
- deleteSession: (sessionId: string, options?: {
422
- params?: Record<string, string>;
423
- }) => Promise<void>;
424
- deleteMultipleSessions: (sessionIds: string[], options?: {
425
- params?: Record<string, string>;
426
- }) => Promise<void>;
427
- isLoading: boolean;
428
- error: string | undefined;
429
- };
430
-
431
- /**
432
- * Hook for common actions like initialization, fetching agents/teams
433
- */
434
- declare function useAgnoActions(): {
435
- initialize: (options?: {
436
- params?: Record<string, string>;
437
- }) => Promise<{
438
- agents: AgentDetails[];
439
- teams: TeamDetails[];
440
- }>;
441
- checkStatus: (options?: {
442
- params?: Record<string, string>;
443
- }) => Promise<boolean>;
444
- fetchAgents: (options?: {
445
- params?: Record<string, string>;
446
- }) => Promise<AgentDetails[]>;
447
- fetchTeams: (options?: {
448
- params?: Record<string, string>;
449
- }) => Promise<TeamDetails[]>;
450
- updateConfig: (updates: Partial<Parameters<(updates: Partial<_rodrigocoliveira_agno_types.AgnoClientConfig>) => void>[0]>) => void;
451
- isInitializing: boolean;
452
- error: string | undefined;
453
- };
454
-
455
- /**
456
- * React hook to subscribe to custom events emitted by the agent backend (yielding CustomEventData).
457
- *
458
- * Custom events are emitted when agent yeilds data not directly related to tool execution or chat messages,
459
- * through the CustomEvent API event type.
460
- *
461
- * @param handler - Optional callback invoked for each custom event
462
- * @returns Object containing accumulated custom events and a clear function
463
- *
464
- * @example
465
- * // Collect all custom events
466
- * const { events } = useAgnoCustomEvents();
467
- *
468
- * @example
469
- * // Handle events as they arrive
470
- * const { events } = useAgnoCustomEvents((event) => {
471
- * if (event.greeting) {
472
- * showToast(event.greeting);
473
- * }
474
- * });
475
- *
476
- * @example
477
- * // Filter for specific event types
478
- * const { events } = useAgnoCustomEvents();
479
- * const greetings = events.filter(e => 'greeting' in e);
480
- *
481
- * @example
482
- * // Clear accumulated events
483
- * const { events, clearEvents } = useAgnoCustomEvents();
484
- * // Later...
485
- * clearEvents();
486
- */
487
- declare function useAgnoCustomEvents(handler?: (event: CustomEventData) => void): {
488
- events: CustomEventData[];
489
- clearEvents: () => void;
490
- };
491
-
492
- /**
493
- * Hook for memory management
494
- */
495
- declare function useAgnoMemory(): {
496
- memories: UserMemory[];
497
- topics: string[];
498
- isLoading: boolean;
499
- error: string | undefined;
500
- fetchMemories: (queryParams?: ListMemoriesParams, options?: {
501
- params?: Record<string, string>;
502
- }) => Promise<MemoriesListResponse>;
503
- getMemoryById: (memoryId: string, options?: {
504
- params?: Record<string, string>;
505
- table?: string;
506
- }) => Promise<UserMemory>;
507
- getMemoryTopics: (options?: {
508
- params?: Record<string, string>;
509
- table?: string;
510
- }) => Promise<string[]>;
511
- getUserMemoryStats: (queryParams?: UserMemoryStatsParams, options?: {
512
- params?: Record<string, string>;
513
- }) => Promise<UserMemoryStatsResponse>;
514
- createMemory: (request: CreateMemoryRequest, options?: {
515
- params?: Record<string, string>;
516
- table?: string;
517
- }) => Promise<UserMemory>;
518
- updateMemory: (memoryId: string, request: UpdateMemoryRequest, options?: {
519
- params?: Record<string, string>;
520
- table?: string;
521
- }) => Promise<UserMemory>;
522
- deleteMemory: (memoryId: string, options?: {
523
- params?: Record<string, string>;
524
- table?: string;
525
- }) => Promise<void>;
526
- deleteMultipleMemories: (memoryIds: string[], options?: {
527
- params?: Record<string, string>;
528
- table?: string;
529
- userId?: string;
530
- }) => Promise<void>;
531
- };
532
-
533
- /**
534
- * Hook for knowledge management
535
- */
536
- declare function useAgnoKnowledge(): {
537
- config: KnowledgeConfigResponse | undefined;
538
- content: ContentResponse[];
539
- isLoading: boolean;
540
- error: string | undefined;
541
- getConfig: (options?: {
542
- dbId?: string;
543
- params?: Record<string, string>;
544
- }) => Promise<KnowledgeConfigResponse>;
545
- listContent: (listOptions?: ContentListOptions, options?: {
546
- params?: Record<string, string>;
547
- }) => Promise<ContentListResponse>;
548
- getContent: (contentId: string, options?: {
549
- dbId?: string;
550
- params?: Record<string, string>;
551
- }) => Promise<ContentResponse>;
552
- getContentStatus: (contentId: string, options?: {
553
- dbId?: string;
554
- params?: Record<string, string>;
555
- }) => Promise<ContentStatusResponse>;
556
- search: (request: VectorSearchRequest, options?: {
557
- params?: Record<string, string>;
558
- }) => Promise<VectorSearchResponse>;
559
- uploadContent: (data: FormData | {
560
- name?: string;
561
- description?: string;
562
- url?: string;
563
- metadata?: Record<string, unknown>;
564
- file?: File;
565
- text_content?: string;
566
- reader_id?: string;
567
- chunker?: string;
568
- chunk_size?: number;
569
- chunk_overlap?: number;
570
- }, options?: {
571
- dbId?: string;
572
- params?: Record<string, string>;
573
- }) => Promise<ContentResponse>;
574
- updateContent: (contentId: string, request: ContentUpdateRequest, options?: {
575
- dbId?: string;
576
- params?: Record<string, string>;
577
- }) => Promise<ContentResponse>;
578
- deleteAllContent: (options?: {
579
- dbId?: string;
580
- params?: Record<string, string>;
581
- }) => Promise<void>;
582
- deleteContent: (contentId: string, options?: {
583
- dbId?: string;
584
- params?: Record<string, string>;
585
- }) => Promise<ContentResponse>;
586
- };
587
-
588
- /**
589
- * Hook for metrics management
590
- *
591
- * Provides methods to fetch and refresh AgentOS metrics.
592
- *
593
- * @example
594
- * ```tsx
595
- * function MetricsDashboard() {
596
- * const {
597
- * metrics,
598
- * fetchMetrics,
599
- * refreshMetrics,
600
- * isLoading,
601
- * isRefreshing,
602
- * error,
603
- * } = useAgnoMetrics();
604
- *
605
- * useEffect(() => {
606
- * fetchMetrics({
607
- * startingDate: '2024-01-01',
608
- * endingDate: '2024-01-31',
609
- * });
610
- * }, [fetchMetrics]);
611
- *
612
- * if (isLoading) return <div>Loading metrics...</div>;
613
- * if (error) return <div>Error: {error}</div>;
614
- *
615
- * return (
616
- * <div>
617
- * {metrics?.metrics.map((day) => (
618
- * <div key={day.id}>
619
- * <h3>{day.date}</h3>
620
- * <p>Agent Runs: {day.agent_runs_count}</p>
621
- * </div>
622
- * ))}
623
- * </div>
624
- * );
625
- * }
626
- * ```
627
- */
628
- declare function useAgnoMetrics(): {
629
- metrics: MetricsResponse | undefined;
630
- fetchMetrics: (options?: MetricsOptions) => Promise<MetricsResponse>;
631
- refreshMetrics: (options?: RefreshMetricsOptions) => Promise<DayAggregatedMetrics[]>;
632
- clearMetrics: () => void;
633
- isLoading: boolean;
634
- isRefreshing: boolean;
635
- error: string | undefined;
636
- };
637
-
638
- /**
639
- * Hook for evaluation management
640
- */
641
- declare function useAgnoEvals(): {
642
- evalRuns: EvalSchema[];
643
- pagination: _rodrigocoliveira_agno_types.PaginationInfo | undefined;
644
- isLoading: boolean;
645
- error: string | undefined;
646
- listEvalRuns: (listParams?: ListEvalRunsParams, options?: {
647
- params?: Record<string, string>;
648
- }) => Promise<EvalRunsListResponse>;
649
- getEvalRun: (evalRunId: string, options?: {
650
- dbId?: string;
651
- table?: string;
652
- params?: Record<string, string>;
653
- }) => Promise<EvalSchema>;
654
- executeEval: (request: ExecuteEvalRequest, options?: {
655
- dbId?: string;
656
- table?: string;
657
- params?: Record<string, string>;
658
- }) => Promise<EvalSchema>;
659
- updateEvalRun: (evalRunId: string, request: UpdateEvalRunRequest, options?: {
660
- dbId?: string;
661
- table?: string;
662
- params?: Record<string, string>;
663
- }) => Promise<EvalSchema>;
664
- deleteEvalRuns: (evalRunIds: string[], options?: {
665
- dbId?: string;
666
- table?: string;
667
- params?: Record<string, string>;
668
- }) => Promise<void>;
669
- renameEvalRun: (evalRunId: string, newName: string, options?: {
670
- dbId?: string;
671
- table?: string;
672
- params?: Record<string, string>;
673
- }) => Promise<EvalSchema>;
674
- };
675
-
676
- /**
677
- * Hook for traces management
678
- *
679
- * Provides methods to:
680
- * - List traces with filters (fetchTraces)
681
- * - Get trace detail or specific span (getTraceDetail)
682
- * - Get trace session statistics (fetchTraceSessionStats)
683
- *
684
- * @example
685
- * ```tsx
686
- * const { traces, fetchTraces, isLoading, error } = useAgnoTraces();
687
- *
688
- * // Fetch traces for a specific session
689
- * useEffect(() => {
690
- * fetchTraces({ session_id: 'my-session-id' });
691
- * }, []);
692
- *
693
- * // Fetch traces with pagination
694
- * const result = await fetchTraces({ page: 1, limit: 10 });
695
- * console.log(result.pagination.total_count);
696
- * ```
697
- */
698
- declare function useAgnoTraces(): {
699
- /** Current list of traces (from last fetchTraces call) */
700
- traces: TraceSummary[];
701
- /** Current trace session statistics (from last fetchTraceSessionStats call) */
702
- traceSessionStats: TraceSessionStats[];
703
- /** Fetch traces with optional filters and pagination */
704
- fetchTraces: (options?: ListTracesOptions, requestOptions?: {
705
- headers?: Record<string, string>;
706
- params?: Record<string, string>;
707
- }) => Promise<PaginatedTracesResult>;
708
- /** Get trace detail or specific span */
709
- getTraceDetail: (traceId: string, options?: GetTraceOptions, requestOptions?: {
710
- headers?: Record<string, string>;
711
- params?: Record<string, string>;
712
- }) => Promise<TraceDetail | TraceNode>;
713
- /** Fetch trace session statistics */
714
- fetchTraceSessionStats: (options?: GetTraceSessionStatsOptions, requestOptions?: {
715
- headers?: Record<string, string>;
716
- params?: Record<string, string>;
717
- }) => Promise<PaginatedTraceSessionStatsResult>;
718
- /** Loading state */
719
- isLoading: boolean;
720
- /** Error message if last operation failed */
721
- error: string | undefined;
722
- };
723
-
724
- 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, useAgnoCustomEvents, useAgnoEvals, useAgnoKnowledge, useAgnoMemory, useAgnoMetrics, useAgnoSession, useAgnoToolExecution, useAgnoTraces, useToolHandlers };
2
+ * @rodrigocoliveira/agno-react
3
+ * React hooks for Agno client
4
+ */
5
+ export { AgnoProvider, useAgnoClient } from './context/AgnoContext';
6
+ export type { AgnoProviderProps } from './context/AgnoContext';
7
+ export { ToolHandlerProvider, useToolHandlers } from './context/ToolHandlerContext';
8
+ export type { ToolHandlerProviderProps, ToolHandlerContextValue } from './context/ToolHandlerContext';
9
+ export { GenerativeUIRenderer } from './components/GenerativeUIRenderer';
10
+ export type { GenerativeUIRendererProps } from './components/GenerativeUIRenderer';
11
+ export { ComponentRegistry, getComponentRegistry, registerChartComponent, getChartComponent, } from './utils/component-registry';
12
+ export type { ComponentRenderer } from './utils/component-registry';
13
+ export { createBarChart, createLineChart, createPieChart, createAreaChart, createCardGrid, createCard, createTable, createColumn, createMarkdown, createArtifact, createSmartChart, createToolResult, resultWithBarChart, resultWithSmartChart, resultWithCardGrid, resultWithTable, } from './utils/ui-helpers';
14
+ export type { ChartHelperOptions, CardGridHelperOptions, TableHelperOptions, } from './utils/ui-helpers';
15
+ export { useAgnoChat } from './hooks/useAgnoChat';
16
+ export { useAgnoSession } from './hooks/useAgnoSession';
17
+ export { useAgnoActions } from './hooks/useAgnoActions';
18
+ export { useAgnoToolExecution, getCustomRender } from './hooks/useAgnoToolExecution';
19
+ export type { ToolHandler, ToolExecutionEvent } from './hooks/useAgnoToolExecution';
20
+ export { useAgnoCustomEvents } from './hooks/useAgnoCustomEvents';
21
+ export { useAgnoMemory } from './hooks/useAgnoMemory';
22
+ export { useAgnoKnowledge } from './hooks/useAgnoKnowledge';
23
+ export { useAgnoMetrics } from './hooks/useAgnoMetrics';
24
+ export { useAgnoEvals } from './hooks/useAgnoEvals';
25
+ export { useAgnoTraces } from './hooks/useAgnoTraces';
26
+ export type { PaginatedTracesResult, PaginatedTraceSessionStatsResult, } from './hooks/useAgnoTraces';
27
+ export type { AgnoClientConfig, ChatMessage, ToolCall, SessionEntry, AgentDetails, TeamDetails, ClientState, RunEvent, UIComponentSpec, ChartComponentSpec, CardGridComponentSpec, TableComponentSpec, MarkdownComponentSpec, CustomComponentSpec, ArtifactComponentSpec, ToolHandlerResult, GenerativeUIData, ChartSeries, CardData, TableColumn, CustomEventData, UserMemory, MemoriesListResponse, ListMemoriesParams, CreateMemoryRequest, UpdateMemoryRequest, DeleteMultipleMemoriesRequest, UserMemoryStats, UserMemoryStatsResponse, UserMemoryStatsParams, ContentStatus, ReaderSchema, ChunkerSchema, VectorDbSchema, KnowledgeConfigResponse, ContentResponse, ContentStatusResponse, ContentListResponse, ContentListOptions, VectorSearchRequest, VectorSearchResult, VectorSearchResponse, ContentUploadRequest, ContentUpdateRequest, TokenMetrics, ModelMetrics, DayAggregatedMetrics, MetricsResponse, MetricsOptions, RefreshMetricsOptions, EvalType, EvalComponentType, ScoringStrategy, SortOrder, EvalSchema, ListEvalRunsParams, EvalRunsListResponse, ExecuteEvalRequest, UpdateEvalRunRequest, DeleteEvalRunsRequest, TraceStatus, TraceSummary, TraceNode, TraceDetail, TraceSessionStats, TracesListResponse, TraceSessionStatsResponse, ListTracesOptions, GetTraceOptions, GetTraceSessionStatsOptions, PaginationInfo, } from '@rodrigocoliveira/agno-types';
28
+ //# sourceMappingURL=index.d.ts.map