@rodrigocoliveira/agno-react 2.0.0 → 2.1.1
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 +35 -12
- package/dist/hooks/useAgnoToolExecution.d.ts +7 -11
- package/dist/hooks/useAgnoToolExecution.d.ts.map +1 -1
- package/dist/index.d.ts +3 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +645 -986
- package/dist/index.js.map +7 -10
- package/dist/index.mjs +564 -905
- package/dist/index.mjs.map +7 -10
- package/dist/ui/components/chart.d.ts +63 -0
- package/dist/ui/components/chart.d.ts.map +1 -0
- package/dist/ui/composed/agno-chat/agno-chat.d.ts +6 -4
- package/dist/ui/composed/agno-chat/agno-chat.d.ts.map +1 -1
- package/dist/ui/composed/agno-chat/tool-building-blocks.d.ts +0 -4
- package/dist/ui/composed/agno-chat/tool-building-blocks.d.ts.map +1 -1
- package/dist/ui/composed/agno-message/tools.d.ts.map +1 -1
- package/dist/ui/composed/generative-components/card-grid.d.ts +4 -0
- package/dist/ui/composed/generative-components/card-grid.d.ts.map +1 -0
- package/dist/ui/composed/generative-components/charts.d.ts +7 -0
- package/dist/ui/composed/generative-components/charts.d.ts.map +1 -0
- package/dist/ui/composed/index.d.ts +6 -2
- package/dist/ui/composed/index.d.ts.map +1 -1
- package/dist/ui/index.d.ts +8 -2
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui.js +586 -424
- package/dist/ui.js.map +9 -11
- package/dist/ui.mjs +606 -430
- package/dist/ui.mjs.map +9 -11
- package/package.json +7 -8
- package/dist/components/GenerativeUIRenderer.d.ts +0 -21
- package/dist/components/GenerativeUIRenderer.d.ts.map +0 -1
- package/dist/utils/component-registry.d.ts +0 -63
- package/dist/utils/component-registry.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -265,24 +265,47 @@ The library ships with a complete set of pre-built UI components accessible via
|
|
|
265
265
|
|
|
266
266
|
### Peer Dependencies
|
|
267
267
|
|
|
268
|
-
|
|
268
|
+
The library ships UI as peer dependencies so your app controls the versions and avoids duplicate React instances. **Required** vs **optional** depends on which import path you use.
|
|
269
|
+
|
|
270
|
+
**If you only import from `@rodrigocoliveira/agno-react` (hooks-only, no UI):** zero peer deps beyond React itself.
|
|
271
|
+
|
|
272
|
+
**If you import anything from `@rodrigocoliveira/agno-react/ui`:** the following are required.
|
|
269
273
|
|
|
270
274
|
```bash
|
|
271
|
-
#
|
|
272
|
-
npm install
|
|
275
|
+
# Required by /ui (used by <AgnoChat> / <Conversation> / <Response>)
|
|
276
|
+
npm install use-stick-to-bottom streamdown
|
|
277
|
+
|
|
278
|
+
# Core styling / variant utilities — required by every component in /ui
|
|
279
|
+
npm install class-variance-authority clsx tailwind-merge lucide-react
|
|
280
|
+
```
|
|
273
281
|
|
|
274
|
-
|
|
275
|
-
npm install shiki streamdown
|
|
282
|
+
**Per-feature optional peer deps** — install only the ones whose components you actually import:
|
|
276
283
|
|
|
277
|
-
|
|
278
|
-
|
|
284
|
+
| If you use… | Install |
|
|
285
|
+
| --- | --- |
|
|
286
|
+
| `<AgnoChat.Input>` with attachments / model select / command palette | `@radix-ui/react-slot @radix-ui/react-dropdown-menu cmdk` |
|
|
287
|
+
| `<Tooltip>` | `@radix-ui/react-tooltip` |
|
|
288
|
+
| `<Avatar>` | `@radix-ui/react-avatar` |
|
|
289
|
+
| `<Accordion>` | `@radix-ui/react-accordion` |
|
|
290
|
+
| `<Collapsible>` (used by `<Tool>` and tool debug card) | `@radix-ui/react-collapsible` |
|
|
291
|
+
| `<HoverCard>` | `@radix-ui/react-hover-card` |
|
|
292
|
+
| `<Select>` | `@radix-ui/react-select` |
|
|
293
|
+
| `<Dialog>` / `<AskUserQuestionModal>` patterns | `@radix-ui/react-dialog` |
|
|
294
|
+
| Code-block syntax highlighting in `<Response>` | `shiki` (auto-loaded by `streamdown` if installed) |
|
|
295
|
+
| `<BarChart>` / `<LineChart>` / `<AreaChart>` / `<PieChart>` | `recharts` |
|
|
279
296
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
297
|
+
**Quick install for "I want everything that ships in `/ui`":**
|
|
298
|
+
|
|
299
|
+
```bash
|
|
300
|
+
npm install use-stick-to-bottom streamdown shiki recharts \
|
|
301
|
+
class-variance-authority clsx tailwind-merge lucide-react cmdk \
|
|
302
|
+
@radix-ui/react-accordion @radix-ui/react-avatar @radix-ui/react-collapsible \
|
|
303
|
+
@radix-ui/react-dialog @radix-ui/react-dropdown-menu @radix-ui/react-hover-card \
|
|
304
|
+
@radix-ui/react-select @radix-ui/react-slot @radix-ui/react-tooltip
|
|
284
305
|
```
|
|
285
306
|
|
|
307
|
+
> **Note:** `use-stick-to-bottom` and `streamdown` were marked `optional` in 2.1.0 and earlier, which prevented `npm install` from warning when they were missing — consumers using `/ui` would then hit a runtime "Could not resolve …" error. As of **2.1.1** they are required peer deps and `npm install` reports them up front.
|
|
308
|
+
|
|
286
309
|
### Import Path
|
|
287
310
|
|
|
288
311
|
All UI components are imported from the `/ui` sub-path:
|
|
@@ -372,7 +395,7 @@ For custom message layouts (reordering slots, replacing sections), use the
|
|
|
372
395
|
|
|
373
396
|
| Component | Description |
|
|
374
397
|
|-----------|-------------|
|
|
375
|
-
| `AgnoChat` | Root wrapper. Accepts `toolHandlers`, `autoExecuteTools`, `renderTool`, `debug`, `
|
|
398
|
+
| `AgnoChat` | Root wrapper. Accepts `toolHandlers`, `autoExecuteTools`, `renderTool`, `debug`, `skipToolsOnSessionLoad`. |
|
|
376
399
|
| `AgnoChat.Messages` | Message list with auto-scroll. Accepts `avatars`, `actions`, `showReasoning`, `showReferences`, `showTimestamp`, `renderMessage`, `renderTool`, and more. |
|
|
377
400
|
| `AgnoChat.EmptyState` | Shown when there are no messages. Place inside `Messages`. |
|
|
378
401
|
| `AgnoChat.SuggestedPrompts` | Clickable prompt suggestions. Place inside `EmptyState`. |
|
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
import type { ToolCall
|
|
2
|
-
/**
|
|
3
|
-
* Tool handler function type (now supports generative UI)
|
|
4
|
-
*/
|
|
1
|
+
import type { ToolCall } from '@rodrigocoliveira/agno-types';
|
|
5
2
|
export type ToolHandler = (args: Record<string, any>) => Promise<any>;
|
|
6
3
|
/**
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Process tool handler result and extract data/UI
|
|
12
|
-
* Exported for use in session loading UI hydration
|
|
4
|
+
* Split a handler return value into (a) the string `tool.result` field sent
|
|
5
|
+
* back to the backend and (b) an optional `ui` spec attached as
|
|
6
|
+
* `tool.ui_component` for consumer renderers to read.
|
|
13
7
|
*/
|
|
14
8
|
export declare function processToolResult(result: any, _tool: ToolCall): {
|
|
15
9
|
resultData: string;
|
|
@@ -31,6 +25,8 @@ export interface ToolExecutionEvent {
|
|
|
31
25
|
*
|
|
32
26
|
* @param handlers - Map of tool names to handler functions (local handlers)
|
|
33
27
|
* @param autoExecute - Whether to automatically execute tools when paused (default: true)
|
|
28
|
+
* @param options.skipToolsOnSessionLoad - Tool names whose handlers should NOT be re-invoked
|
|
29
|
+
* when a saved session is loaded. Use this for interactive tools with side effects.
|
|
34
30
|
*
|
|
35
31
|
* @example
|
|
36
32
|
* ```tsx
|
|
@@ -49,7 +45,7 @@ export interface ToolExecutionEvent {
|
|
|
49
45
|
* ```
|
|
50
46
|
*/
|
|
51
47
|
export declare function useAgnoToolExecution(handlers?: Record<string, ToolHandler>, autoExecute?: boolean, options?: {
|
|
52
|
-
|
|
48
|
+
skipToolsOnSessionLoad?: string[];
|
|
53
49
|
}): {
|
|
54
50
|
/** Whether the run is currently paused awaiting tool execution */
|
|
55
51
|
isPaused: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAgnoToolExecution.d.ts","sourceRoot":"","sources":["../../src/hooks/useAgnoToolExecution.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,QAAQ,
|
|
1
|
+
{"version":3,"file":"useAgnoToolExecution.d.ts","sourceRoot":"","sources":["../../src/hooks/useAgnoToolExecution.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,QAAQ,EAGT,MAAM,8BAA8B,CAAC;AAItC,MAAM,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;AAUtE;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,GAAG;IAC/D,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,GAAG,CAAC;CACnB,CAoBA;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,GAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAM,EAC1C,WAAW,GAAE,OAAc,EAC3B,OAAO,CAAC,EAAE;IAAE,sBAAsB,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE;IA4O7C,kEAAkE;;IAElE,iDAAiD;;IAEjD,+BAA+B;;IAE/B,qDAAqD;;IAErD,mEAAmE;0BAlErD,QAAQ,EAAE,KAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAoE9C,2DAA2D;iCAjC7C,QAAQ,EAAE,YAAY;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE;IAmCzG,wCAAwC;;EAG3C"}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,21 +6,17 @@ export { AgnoProvider, useAgnoClient } from './context/AgnoContext';
|
|
|
6
6
|
export type { AgnoProviderProps } from './context/AgnoContext';
|
|
7
7
|
export { ToolHandlerProvider, useToolHandlers } from './context/ToolHandlerContext';
|
|
8
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
9
|
export { createBarChart, createLineChart, createPieChart, createAreaChart, createCardGrid, createCard, createTable, createColumn, createMarkdown, createArtifact, createSmartChart, createToolResult, resultWithBarChart, resultWithSmartChart, resultWithCardGrid, resultWithTable, } from './utils/ui-helpers';
|
|
14
10
|
export type { ChartHelperOptions, CardGridHelperOptions, TableHelperOptions, } from './utils/ui-helpers';
|
|
15
11
|
export { useAgnoChat } from './hooks/useAgnoChat';
|
|
16
12
|
export { useAgnoSession } from './hooks/useAgnoSession';
|
|
17
13
|
export { useAgnoActions } from './hooks/useAgnoActions';
|
|
18
|
-
export { useAgnoToolExecution
|
|
14
|
+
export { useAgnoToolExecution } from './hooks/useAgnoToolExecution';
|
|
19
15
|
export type { ToolHandler, ToolExecutionEvent } from './hooks/useAgnoToolExecution';
|
|
20
16
|
export { byToolName } from './ui/composed/agno-chat/render-tool';
|
|
21
17
|
export type { RenderTool, ToolRenderArgs, ToolEntry } from './ui/composed/agno-chat/render-tool';
|
|
22
|
-
export { ToolDebugCard
|
|
23
|
-
export type { ToolDebugCardProps
|
|
18
|
+
export { ToolDebugCard } from './ui/composed/agno-chat/tool-building-blocks';
|
|
19
|
+
export type { ToolDebugCardProps } from './ui/composed/agno-chat/tool-building-blocks';
|
|
24
20
|
export { AgnoMessage, AgnoMessageReasoning, AgnoMessageMedia, AgnoMessageTools, AgnoMessageContent, AgnoMessageReferences, AgnoMessageFooter, AgnoMessageContext, useAgnoMessageContext, } from './ui/composed/agno-message';
|
|
25
21
|
export type { AgnoMessageProps, AgnoMessageToolsProps, AgnoMessageFooterProps, AgnoMessageContextValue, } from './ui/composed/agno-message';
|
|
26
22
|
export { useAgnoCustomEvents } from './hooks/useAgnoCustomEvents';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACpE,YAAY,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACpF,YAAY,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAGtG,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACpE,YAAY,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACpF,YAAY,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAGtG,OAAO,EACL,cAAc,EACd,eAAe,EACf,cAAc,EACd,eAAe,EACf,cAAc,EACd,UAAU,EACV,WAAW,EACX,YAAY,EACZ,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,o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