@rodrigocoliveira/agno-react 2.1.0 → 2.2.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 +34 -11
- package/dist/hooks/useAgnoChat.d.ts +1 -0
- package/dist/hooks/useAgnoChat.d.ts.map +1 -1
- package/dist/index.js +19 -14
- package/dist/index.js.map +6 -6
- package/dist/index.mjs +19 -14
- package/dist/index.mjs.map +6 -6
- package/dist/ui/composed/AgnoMessageItem.d.ts +3 -1
- package/dist/ui/composed/AgnoMessageItem.d.ts.map +1 -1
- package/dist/ui/composed/agno-chat/agno-chat.d.ts +18 -1
- package/dist/ui/composed/agno-chat/agno-chat.d.ts.map +1 -1
- package/dist/ui/composed/agno-chat/messages.d.ts.map +1 -1
- package/dist/ui/composed/agno-message/context.d.ts +7 -0
- package/dist/ui/composed/agno-message/context.d.ts.map +1 -1
- package/dist/ui/composed/agno-message/footer.d.ts.map +1 -1
- package/dist/ui/composed/agno-message/message.d.ts +8 -1
- package/dist/ui/composed/agno-message/message.d.ts.map +1 -1
- package/dist/ui.js +27 -15
- package/dist/ui.js.map +8 -8
- package/dist/ui.mjs +27 -15
- package/dist/ui.mjs.map +8 -8
- package/package.json +3 -9
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:
|
|
@@ -8,6 +8,7 @@ export declare function useAgnoChat(): {
|
|
|
8
8
|
sendMessage: (message: string | FormData, options?: {
|
|
9
9
|
headers?: Record<string, string>;
|
|
10
10
|
params?: Record<string, string>;
|
|
11
|
+
background?: boolean;
|
|
11
12
|
}) => Promise<void>;
|
|
12
13
|
clearMessages: () => void;
|
|
13
14
|
cancelRun: () => Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAgnoChat.d.ts","sourceRoot":"","sources":["../../src/hooks/useAgnoChat.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAG7E;;;GAGG;AACH,wBAAgB,WAAW;;2BAkEP,MAAM,GAAG,QAAQ,YAAY;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"useAgnoChat.d.ts","sourceRoot":"","sources":["../../src/hooks/useAgnoChat.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAG7E;;;GAGG;AACH,wBAAgB,WAAW;;2BAkEP,MAAM,GAAG,QAAQ,YAAY;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAAC,UAAU,CAAC,EAAE,OAAO,CAAA;KAAE;;;;;;;;;;EAsC3I"}
|
package/dist/index.js
CHANGED
|
@@ -2213,25 +2213,27 @@ function AgnoMessageReferences() {
|
|
|
2213
2213
|
var import_lucide_react11 = require("lucide-react");
|
|
2214
2214
|
var jsx_runtime21 = require("react/jsx-runtime");
|
|
2215
2215
|
function AgnoMessageFooter({ showTimestamp = true } = {}) {
|
|
2216
|
-
const { message, classNames, actions, isLastAssistantMessage, formatTimestamp } = useAgnoMessageContext();
|
|
2216
|
+
const { message, classNames, actions, isLastAssistantMessage, isStreamingThisMessage, formatTimestamp } = useAgnoMessageContext();
|
|
2217
2217
|
const hasError = message.streamingError;
|
|
2218
2218
|
const isCustomTimestamp = !!formatTimestamp;
|
|
2219
2219
|
const resolvedFormatTimestamp = formatTimestamp ?? formatSmartTimestamp;
|
|
2220
|
-
if (
|
|
2220
|
+
if (isStreamingThisMessage)
|
|
2221
2221
|
return null;
|
|
2222
|
+
const hasActions = !!actions?.assistant;
|
|
2223
|
+
const visibility = actions?.visibility ?? "visible";
|
|
2224
|
+
if (hasActions && visibility === "last-assistant" && !isLastAssistantMessage) {
|
|
2225
|
+
return null;
|
|
2226
|
+
}
|
|
2227
|
+
if (!hasActions && !showTimestamp && !hasError)
|
|
2228
|
+
return null;
|
|
2229
|
+
const useHover = hasActions && (visibility === "hover" || visibility === "hover-last-visible" && !isLastAssistantMessage);
|
|
2222
2230
|
return /* @__PURE__ */ jsx_runtime21.jsxs("div", {
|
|
2223
|
-
className: "flex items-center gap-2 pt-1",
|
|
2231
|
+
className: cn("flex items-center gap-2 pt-1 transition-opacity", useHover && "opacity-0 group-hover/message:opacity-100"),
|
|
2224
2232
|
children: [
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
const useHover = visibility === "hover" || visibility === "hover-last-visible" && !isLastAssistantMessage;
|
|
2230
|
-
return /* @__PURE__ */ jsx_runtime21.jsx("div", {
|
|
2231
|
-
className: cn("flex items-center gap-1 transition-opacity", useHover && "opacity-0 group-hover/message:opacity-100", classNames?.assistant?.actions),
|
|
2232
|
-
children: actions.assistant(message)
|
|
2233
|
-
});
|
|
2234
|
-
})(),
|
|
2233
|
+
hasActions && /* @__PURE__ */ jsx_runtime21.jsx("div", {
|
|
2234
|
+
className: cn("flex items-center gap-1", classNames?.assistant?.actions),
|
|
2235
|
+
children: actions.assistant(message)
|
|
2236
|
+
}),
|
|
2235
2237
|
hasError && /* @__PURE__ */ jsx_runtime21.jsxs("span", {
|
|
2236
2238
|
className: "flex items-center gap-1 text-[11px] text-destructive",
|
|
2237
2239
|
children: [
|
|
@@ -2273,6 +2275,7 @@ function AgnoMessage({
|
|
|
2273
2275
|
avatars,
|
|
2274
2276
|
actions,
|
|
2275
2277
|
isLastAssistantMessage = false,
|
|
2278
|
+
isStreamingThisMessage = false,
|
|
2276
2279
|
showFilePreview = true,
|
|
2277
2280
|
showImageLightbox = true,
|
|
2278
2281
|
showTimestamp = true,
|
|
@@ -2288,6 +2291,7 @@ function AgnoMessage({
|
|
|
2288
2291
|
const ctx = import_react13.useMemo(() => ({
|
|
2289
2292
|
message,
|
|
2290
2293
|
isLastAssistantMessage,
|
|
2294
|
+
isStreamingThisMessage,
|
|
2291
2295
|
classNames,
|
|
2292
2296
|
actions,
|
|
2293
2297
|
avatars,
|
|
@@ -2308,6 +2312,7 @@ function AgnoMessage({
|
|
|
2308
2312
|
}), [
|
|
2309
2313
|
message,
|
|
2310
2314
|
isLastAssistantMessage,
|
|
2315
|
+
isStreamingThisMessage,
|
|
2311
2316
|
classNames,
|
|
2312
2317
|
actions,
|
|
2313
2318
|
avatars,
|
|
@@ -3277,4 +3282,4 @@ function useAgnoComponents() {
|
|
|
3277
3282
|
};
|
|
3278
3283
|
}
|
|
3279
3284
|
|
|
3280
|
-
//# debugId=
|
|
3285
|
+
//# debugId=F99024C6D7DF795064756E2164756E21
|