@antipopp/agno-react 0.10.0 → 0.11.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/README.md CHANGED
@@ -38,6 +38,10 @@ function App() {
38
38
  },
39
39
  params: { // Optional: Global query params for all requests
40
40
  locale: 'en-US'
41
+ },
42
+ dependencies: { // Optional: Global run dependencies for sendMessage
43
+ tenantId: 'tenant-1',
44
+ locale: 'en-US'
41
45
  }
42
46
  }}
43
47
  >
@@ -133,9 +137,14 @@ await sendMessage('Hello!');
133
137
  // Send with FormData (for file uploads)
134
138
  const formData = new FormData();
135
139
  formData.append('message', 'Hello!');
136
- formData.append('file', file);
140
+ formData.append('files', file);
137
141
  await sendMessage(formData);
138
142
 
143
+ // Send with files option
144
+ await sendMessage('Hello!', {
145
+ files: [file]
146
+ });
147
+
139
148
  // Send with custom headers
140
149
  await sendMessage('Hello!', {
141
150
  headers: { 'X-Custom': 'value' }
@@ -151,6 +160,14 @@ await sendMessage('Hello!', {
151
160
  headers: { 'X-Request-ID': '12345' },
152
161
  params: { debug: 'true' }
153
162
  });
163
+
164
+ // Send with per-request dependencies (merged with/override provider config)
165
+ await sendMessage('Hello!', {
166
+ dependencies: {
167
+ locale: 'fr-FR', // overrides global dependency
168
+ feature: 'rag' // merged as a new dependency key
169
+ }
170
+ });
154
171
  ```
155
172
 
156
173
  #### `clearMessages()`
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as _antipopp_agno_types from '@antipopp/agno-types';
2
2
  import { UIComponentSpec, AgnoClientConfig, ToolCall, CustomRenderFunction, AgentDetails, TeamDetails, ChatMessage, ClientState, SessionEntry, ChartComponentSpec, ArtifactComponentSpec, CardData, CardGridComponentSpec, TableColumn, MarkdownComponentSpec, TableComponentSpec, ToolHandlerResult } from '@antipopp/agno-types';
3
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';
4
+ import React, { ReactNode } from 'react';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
  import { AgnoClient } from '@antipopp/agno-client';
7
7
 
@@ -42,7 +42,7 @@ declare function useAgnoClient(): AgnoClient;
42
42
  /**
43
43
  * Tool handler function type (now supports generative UI)
44
44
  */
45
- type ToolHandler = (args: Record<string, any>) => Promise<any>;
45
+ type ToolHandler = (args: Record<string, unknown> | string) => Promise<unknown>;
46
46
  /**
47
47
  * Get a custom render function by key
48
48
  */
@@ -177,10 +177,7 @@ declare function useAgnoActions(): {
177
177
  */
178
178
  declare function useAgnoChat(): {
179
179
  messages: ChatMessage[];
180
- sendMessage: (message: string | FormData, options?: {
181
- headers?: Record<string, string>;
182
- params?: Record<string, string>;
183
- }) => Promise<void>;
180
+ sendMessage: (message: string | FormData, options?: Parameters<(message: string | FormData, options?: _antipopp_agno_types.SendMessageOptions) => Promise<void>>[1]) => Promise<void>;
184
181
  clearMessages: () => void;
185
182
  cancelRun: () => Promise<void>;
186
183
  isStreaming: boolean;
@@ -214,10 +211,11 @@ declare function useAgnoSession(): {
214
211
  * Maps component specifications to actual React components.
215
212
  * Allows registering custom components at runtime.
216
213
  */
214
+
217
215
  /**
218
216
  * Component renderer function type
219
217
  */
220
- type ComponentRenderer = (props: any) => any;
218
+ type ComponentRenderer = (props: Record<string, unknown>) => ReactNode;
221
219
  /**
222
220
  * Component registry class
223
221
  */
@@ -284,6 +282,12 @@ declare function getChartComponent(name: string): ComponentRenderer | undefined;
284
282
  * manually constructing the full specification object.
285
283
  */
286
284
 
285
+ type DataRow = Record<string, unknown>;
286
+ type SeriesInput = Array<{
287
+ key: string;
288
+ label?: string;
289
+ color?: string;
290
+ }>;
287
291
  /**
288
292
  * Chart helper options
289
293
  */
@@ -306,33 +310,21 @@ interface ChartHelperOptions {
306
310
  /**
307
311
  * Create a bar chart specification
308
312
  */
309
- declare function createBarChart(data: any[], xKey: string, bars: Array<{
310
- key: string;
311
- label?: string;
312
- color?: string;
313
- }>, options?: ChartHelperOptions): ChartComponentSpec;
313
+ declare function createBarChart(data: DataRow[], xKey: string, bars: SeriesInput, options?: ChartHelperOptions): ChartComponentSpec;
314
314
  /**
315
315
  * Create a line chart specification
316
316
  */
317
- declare function createLineChart(data: any[], xKey: string, lines: Array<{
318
- key: string;
319
- label?: string;
320
- color?: string;
321
- }>, options?: ChartHelperOptions): ChartComponentSpec;
317
+ declare function createLineChart(data: DataRow[], xKey: string, lines: SeriesInput, options?: ChartHelperOptions): ChartComponentSpec;
322
318
  /**
323
319
  * Create a pie chart specification
324
320
  */
325
- declare function createPieChart(data: any[], dataKey: string, nameKey: string, options?: ChartHelperOptions & {
321
+ declare function createPieChart(data: DataRow[], dataKey: string, nameKey: string, options?: ChartHelperOptions & {
326
322
  showLabel?: boolean;
327
323
  }): ChartComponentSpec;
328
324
  /**
329
325
  * Create an area chart specification
330
326
  */
331
- declare function createAreaChart(data: any[], xKey: string, areas: Array<{
332
- key: string;
333
- label?: string;
334
- color?: string;
335
- }>, options?: ChartHelperOptions): ChartComponentSpec;
327
+ declare function createAreaChart(data: DataRow[], xKey: string, areas: SeriesInput, options?: ChartHelperOptions): ChartComponentSpec;
336
328
  /**
337
329
  * Card grid helper options
338
330
  */
@@ -358,7 +350,7 @@ declare function createCardGrid(cards: CardData[], options?: CardGridHelperOptio
358
350
  */
359
351
  declare function createCard(id: string, title: string, description?: string, options?: {
360
352
  image?: string;
361
- metadata?: Record<string, any>;
353
+ metadata?: Record<string, unknown>;
362
354
  actions?: CardData["actions"];
363
355
  }): CardData;
364
356
  /**
@@ -379,7 +371,7 @@ interface TableHelperOptions {
379
371
  /**
380
372
  * Create a table specification
381
373
  */
382
- declare function createTable(data: Record<string, any>[], columns: TableColumn[], options?: TableHelperOptions): TableComponentSpec;
374
+ declare function createTable(data: DataRow[], columns: TableColumn[], options?: TableHelperOptions): TableComponentSpec;
383
375
  /**
384
376
  * Create a table column definition
385
377
  */
@@ -409,7 +401,7 @@ declare function createArtifact(content: UIComponentSpec[], options?: {
409
401
  /**
410
402
  * Smart chart creator - automatically chooses the best chart type based on data
411
403
  */
412
- declare function createSmartChart(data: any[], options?: {
404
+ declare function createSmartChart(data: DataRow[], options?: {
413
405
  title?: string;
414
406
  description?: string;
415
407
  layout?: "inline" | "artifact";
@@ -420,19 +412,15 @@ declare function createSmartChart(data: any[], options?: {
420
412
  /**
421
413
  * Wrap data and UI into a ToolHandlerResult
422
414
  */
423
- declare function createToolResult(data: any, ui: UIComponentSpec): ToolHandlerResult;
415
+ declare function createToolResult(data: unknown, ui: UIComponentSpec): ToolHandlerResult;
424
416
  /**
425
417
  * Quick helper: create a tool result with a bar chart
426
418
  */
427
- declare function resultWithBarChart(data: any[], xKey: string, bars: Array<{
428
- key: string;
429
- label?: string;
430
- color?: string;
431
- }>, options?: ChartHelperOptions): ToolHandlerResult;
419
+ declare function resultWithBarChart(data: DataRow[], xKey: string, bars: SeriesInput, options?: ChartHelperOptions): ToolHandlerResult;
432
420
  /**
433
421
  * Quick helper: create a tool result with a smart chart
434
422
  */
435
- declare function resultWithSmartChart(data: any[], options?: Parameters<typeof createSmartChart>[1]): ToolHandlerResult;
423
+ declare function resultWithSmartChart(data: DataRow[], options?: Parameters<typeof createSmartChart>[1]): ToolHandlerResult;
436
424
  /**
437
425
  * Quick helper: create a tool result with a card grid
438
426
  */
@@ -440,6 +428,6 @@ declare function resultWithCardGrid(cards: CardData[], options?: CardGridHelperO
440
428
  /**
441
429
  * Quick helper: create a tool result with a table
442
430
  */
443
- declare function resultWithTable(data: Record<string, any>[], columns: TableColumn[], options?: TableHelperOptions): ToolHandlerResult;
431
+ declare function resultWithTable(data: DataRow[], columns: TableColumn[], options?: TableHelperOptions): ToolHandlerResult;
444
432
 
445
433
  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,7 +1,7 @@
1
1
  import * as _antipopp_agno_types from '@antipopp/agno-types';
2
2
  import { UIComponentSpec, AgnoClientConfig, ToolCall, CustomRenderFunction, AgentDetails, TeamDetails, ChatMessage, ClientState, SessionEntry, ChartComponentSpec, ArtifactComponentSpec, CardData, CardGridComponentSpec, TableColumn, MarkdownComponentSpec, TableComponentSpec, ToolHandlerResult } from '@antipopp/agno-types';
3
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';
4
+ import React, { ReactNode } from 'react';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
  import { AgnoClient } from '@antipopp/agno-client';
7
7
 
@@ -42,7 +42,7 @@ declare function useAgnoClient(): AgnoClient;
42
42
  /**
43
43
  * Tool handler function type (now supports generative UI)
44
44
  */
45
- type ToolHandler = (args: Record<string, any>) => Promise<any>;
45
+ type ToolHandler = (args: Record<string, unknown> | string) => Promise<unknown>;
46
46
  /**
47
47
  * Get a custom render function by key
48
48
  */
@@ -177,10 +177,7 @@ declare function useAgnoActions(): {
177
177
  */
178
178
  declare function useAgnoChat(): {
179
179
  messages: ChatMessage[];
180
- sendMessage: (message: string | FormData, options?: {
181
- headers?: Record<string, string>;
182
- params?: Record<string, string>;
183
- }) => Promise<void>;
180
+ sendMessage: (message: string | FormData, options?: Parameters<(message: string | FormData, options?: _antipopp_agno_types.SendMessageOptions) => Promise<void>>[1]) => Promise<void>;
184
181
  clearMessages: () => void;
185
182
  cancelRun: () => Promise<void>;
186
183
  isStreaming: boolean;
@@ -214,10 +211,11 @@ declare function useAgnoSession(): {
214
211
  * Maps component specifications to actual React components.
215
212
  * Allows registering custom components at runtime.
216
213
  */
214
+
217
215
  /**
218
216
  * Component renderer function type
219
217
  */
220
- type ComponentRenderer = (props: any) => any;
218
+ type ComponentRenderer = (props: Record<string, unknown>) => ReactNode;
221
219
  /**
222
220
  * Component registry class
223
221
  */
@@ -284,6 +282,12 @@ declare function getChartComponent(name: string): ComponentRenderer | undefined;
284
282
  * manually constructing the full specification object.
285
283
  */
286
284
 
285
+ type DataRow = Record<string, unknown>;
286
+ type SeriesInput = Array<{
287
+ key: string;
288
+ label?: string;
289
+ color?: string;
290
+ }>;
287
291
  /**
288
292
  * Chart helper options
289
293
  */
@@ -306,33 +310,21 @@ interface ChartHelperOptions {
306
310
  /**
307
311
  * Create a bar chart specification
308
312
  */
309
- declare function createBarChart(data: any[], xKey: string, bars: Array<{
310
- key: string;
311
- label?: string;
312
- color?: string;
313
- }>, options?: ChartHelperOptions): ChartComponentSpec;
313
+ declare function createBarChart(data: DataRow[], xKey: string, bars: SeriesInput, options?: ChartHelperOptions): ChartComponentSpec;
314
314
  /**
315
315
  * Create a line chart specification
316
316
  */
317
- declare function createLineChart(data: any[], xKey: string, lines: Array<{
318
- key: string;
319
- label?: string;
320
- color?: string;
321
- }>, options?: ChartHelperOptions): ChartComponentSpec;
317
+ declare function createLineChart(data: DataRow[], xKey: string, lines: SeriesInput, options?: ChartHelperOptions): ChartComponentSpec;
322
318
  /**
323
319
  * Create a pie chart specification
324
320
  */
325
- declare function createPieChart(data: any[], dataKey: string, nameKey: string, options?: ChartHelperOptions & {
321
+ declare function createPieChart(data: DataRow[], dataKey: string, nameKey: string, options?: ChartHelperOptions & {
326
322
  showLabel?: boolean;
327
323
  }): ChartComponentSpec;
328
324
  /**
329
325
  * Create an area chart specification
330
326
  */
331
- declare function createAreaChart(data: any[], xKey: string, areas: Array<{
332
- key: string;
333
- label?: string;
334
- color?: string;
335
- }>, options?: ChartHelperOptions): ChartComponentSpec;
327
+ declare function createAreaChart(data: DataRow[], xKey: string, areas: SeriesInput, options?: ChartHelperOptions): ChartComponentSpec;
336
328
  /**
337
329
  * Card grid helper options
338
330
  */
@@ -358,7 +350,7 @@ declare function createCardGrid(cards: CardData[], options?: CardGridHelperOptio
358
350
  */
359
351
  declare function createCard(id: string, title: string, description?: string, options?: {
360
352
  image?: string;
361
- metadata?: Record<string, any>;
353
+ metadata?: Record<string, unknown>;
362
354
  actions?: CardData["actions"];
363
355
  }): CardData;
364
356
  /**
@@ -379,7 +371,7 @@ interface TableHelperOptions {
379
371
  /**
380
372
  * Create a table specification
381
373
  */
382
- declare function createTable(data: Record<string, any>[], columns: TableColumn[], options?: TableHelperOptions): TableComponentSpec;
374
+ declare function createTable(data: DataRow[], columns: TableColumn[], options?: TableHelperOptions): TableComponentSpec;
383
375
  /**
384
376
  * Create a table column definition
385
377
  */
@@ -409,7 +401,7 @@ declare function createArtifact(content: UIComponentSpec[], options?: {
409
401
  /**
410
402
  * Smart chart creator - automatically chooses the best chart type based on data
411
403
  */
412
- declare function createSmartChart(data: any[], options?: {
404
+ declare function createSmartChart(data: DataRow[], options?: {
413
405
  title?: string;
414
406
  description?: string;
415
407
  layout?: "inline" | "artifact";
@@ -420,19 +412,15 @@ declare function createSmartChart(data: any[], options?: {
420
412
  /**
421
413
  * Wrap data and UI into a ToolHandlerResult
422
414
  */
423
- declare function createToolResult(data: any, ui: UIComponentSpec): ToolHandlerResult;
415
+ declare function createToolResult(data: unknown, ui: UIComponentSpec): ToolHandlerResult;
424
416
  /**
425
417
  * Quick helper: create a tool result with a bar chart
426
418
  */
427
- declare function resultWithBarChart(data: any[], xKey: string, bars: Array<{
428
- key: string;
429
- label?: string;
430
- color?: string;
431
- }>, options?: ChartHelperOptions): ToolHandlerResult;
419
+ declare function resultWithBarChart(data: DataRow[], xKey: string, bars: SeriesInput, options?: ChartHelperOptions): ToolHandlerResult;
432
420
  /**
433
421
  * Quick helper: create a tool result with a smart chart
434
422
  */
435
- declare function resultWithSmartChart(data: any[], options?: Parameters<typeof createSmartChart>[1]): ToolHandlerResult;
423
+ declare function resultWithSmartChart(data: DataRow[], options?: Parameters<typeof createSmartChart>[1]): ToolHandlerResult;
436
424
  /**
437
425
  * Quick helper: create a tool result with a card grid
438
426
  */
@@ -440,6 +428,6 @@ declare function resultWithCardGrid(cards: CardData[], options?: CardGridHelperO
440
428
  /**
441
429
  * Quick helper: create a tool result with a table
442
430
  */
443
- declare function resultWithTable(data: Record<string, any>[], columns: TableColumn[], options?: TableHelperOptions): ToolHandlerResult;
431
+ declare function resultWithTable(data: DataRow[], columns: TableColumn[], options?: TableHelperOptions): ToolHandlerResult;
444
432
 
445
433
  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 };