@cntyclub/agent-react 0.13.0 → 0.14.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/components/agent-panel.d.ts +7 -1
- package/dist/components/agent-panel.d.ts.map +1 -1
- package/dist/components/agent-widget.d.ts.map +1 -1
- package/dist/index.js +16 -3
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +17 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -14,11 +14,17 @@ export interface AgentPanelProps {
|
|
|
14
14
|
onAlwaysApprove: (toolName: string) => void;
|
|
15
15
|
/** Message id to render a "New messages" divider before (arrived while closed). */
|
|
16
16
|
newMessageAnchorId?: string | null;
|
|
17
|
+
/**
|
|
18
|
+
* Render the close control as a "collapse to the right" affordance (two right
|
|
19
|
+
* chevrons) instead of an ✕. Used by the docked presentation, where closing
|
|
20
|
+
* collapses the panel to the side rather than dismissing a dialog.
|
|
21
|
+
*/
|
|
22
|
+
collapseToSide?: boolean;
|
|
17
23
|
className?: string;
|
|
18
24
|
}
|
|
19
25
|
/**
|
|
20
26
|
* The chat surface shared by the popup panel and fullscreen Agent Mode.
|
|
21
27
|
* Header (title, history, new chat, expand/collapse, close) + messages + input.
|
|
22
28
|
*/
|
|
23
|
-
export declare function AgentPanel({ agentMode, canToggleAgentMode, chat, className, config, newMessageAnchorId, onAlwaysApprove, onClose, onToggleAgentMode, }: AgentPanelProps): React.JSX.Element;
|
|
29
|
+
export declare function AgentPanel({ agentMode, canToggleAgentMode, chat, className, collapseToSide, config, newMessageAnchorId, onAlwaysApprove, onClose, onToggleAgentMode, }: AgentPanelProps): React.JSX.Element;
|
|
24
30
|
//# sourceMappingURL=agent-panel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-panel.d.ts","sourceRoot":"","sources":["../../src/components/agent-panel.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"agent-panel.d.ts","sourceRoot":"","sources":["../../src/components/agent-panel.tsx"],"names":[],"mappings":"AAgCA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAQ5C,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,WAAW,CAAC;IACpB,IAAI,EAAE,cAAc,GAAG,gBAAgB,CAAC;IACxC,yCAAyC;IACzC,SAAS,EAAE,OAAO,CAAC;IACnB,4DAA4D;IAC5D,kBAAkB,EAAE,OAAO,CAAC;IAC5B,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAC9B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,iEAAiE;IACjE,eAAe,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,mFAAmF;IACnF,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EACzB,SAAS,EACT,kBAAkB,EAClB,IAAI,EACJ,SAAS,EACT,cAAc,EACd,MAAM,EACN,kBAAkB,EAClB,eAAe,EACf,OAAO,EACP,iBAAiB,GAClB,EAAE,eAAe,qBAqVjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-widget.d.ts","sourceRoot":"","sources":["../../src/components/agent-widget.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAgB,MAAM,UAAU,CAAC;AAK1D,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,WAAW,CAAC;IACpB,wCAAwC;IACxC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC;;;;;;;;;OASG;IACH,YAAY,CAAC,EAAE,UAAU,GAAG,QAAQ,CAAC;CACtC;AAQD;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CAAC,EAC1B,MAAM,EACN,YAAY,EACZ,IAAI,EAAE,cAAc,EACpB,YAAyB,GAC1B,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"agent-widget.d.ts","sourceRoot":"","sources":["../../src/components/agent-widget.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAgB,MAAM,UAAU,CAAC;AAK1D,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,WAAW,CAAC;IACpB,wCAAwC;IACxC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC;;;;;;;;;OASG;IACH,YAAY,CAAC,EAAE,UAAU,GAAG,QAAQ,CAAC;CACtC;AAQD;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CAAC,EAC1B,MAAM,EACN,YAAY,EACZ,IAAI,EAAE,cAAc,EACpB,YAAyB,GAC1B,EAAE,gBAAgB,qBAgUlB"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { cn, Button, Tooltip, TooltipTrigger, TooltipContent, ChatMessage, ChatMessageBubble, Markdown, Spinner, Checkbox, Collapsible, CollapsibleTrigger, ChatToolChip, CollapsiblePanel, ChatToolCard, ChatToolCardHeader, ChatToolCardActions, Group, Menu, MenuTrigger, MenuPopup, MenuItem, ChatHeader, ChatHeaderAvatar, ChatHeaderTitle, ChatHeaderActions, Chat, ChatEmptyState, ChatEmptyStateIcon, ChatEmptyStateTitle, ChatEmptyStateDescription, ChatSuggestions, ChatSuggestion, useMediaQuery, TooltipProvider, DataTablePaged } from '@cntyclub/ui-react';
|
|
2
|
-
import { XIcon, Trash2Icon, SquareIcon, PauseIcon, PlayIcon, CheckIcon, Loader2Icon, FileTextIcon, PaperclipIcon, MicIcon, ArrowUpIcon, CopyIcon, Maximize2Icon, ListChecksIcon, ChevronDownIcon, ShieldAlertIcon, CheckCheckIcon, UploadCloudIcon, HistoryIcon, SquarePenIcon, Minimize2Icon, SparklesIcon, DownloadIcon, CodeIcon } from 'lucide-react';
|
|
2
|
+
import { XIcon, Trash2Icon, SquareIcon, PauseIcon, PlayIcon, CheckIcon, Loader2Icon, FileTextIcon, PaperclipIcon, MicIcon, ArrowUpIcon, CopyIcon, Maximize2Icon, ListChecksIcon, ChevronDownIcon, ShieldAlertIcon, CheckCheckIcon, UploadCloudIcon, HistoryIcon, SquarePenIcon, Minimize2Icon, ChevronsRightIcon, SparklesIcon, DownloadIcon, CodeIcon } from 'lucide-react';
|
|
3
3
|
import * as React11 from 'react';
|
|
4
4
|
import { AnimatePresence, motion } from 'motion/react';
|
|
5
5
|
import { createPortal } from 'react-dom';
|
|
@@ -1494,6 +1494,7 @@ function AgentPanel({
|
|
|
1494
1494
|
canToggleAgentMode,
|
|
1495
1495
|
chat,
|
|
1496
1496
|
className,
|
|
1497
|
+
collapseToSide,
|
|
1497
1498
|
config,
|
|
1498
1499
|
newMessageAnchorId,
|
|
1499
1500
|
onAlwaysApprove,
|
|
@@ -1662,7 +1663,16 @@ function AgentPanel({
|
|
|
1662
1663
|
),
|
|
1663
1664
|
/* @__PURE__ */ jsx(TooltipContent, { children: agentMode ? "Exit Agent Mode" : "Agent Mode" })
|
|
1664
1665
|
] }) : null,
|
|
1665
|
-
/* @__PURE__ */ jsx(
|
|
1666
|
+
/* @__PURE__ */ jsx(
|
|
1667
|
+
Button,
|
|
1668
|
+
{
|
|
1669
|
+
"aria-label": collapseToSide ? "Collapse agent" : "Close",
|
|
1670
|
+
onClick: onClose,
|
|
1671
|
+
size: "icon-sm",
|
|
1672
|
+
variant: "ghost",
|
|
1673
|
+
children: collapseToSide ? /* @__PURE__ */ jsx(ChevronsRightIcon, {}) : /* @__PURE__ */ jsx(XIcon, {})
|
|
1674
|
+
}
|
|
1675
|
+
)
|
|
1666
1676
|
] })
|
|
1667
1677
|
] }),
|
|
1668
1678
|
view === "history" ? /* @__PURE__ */ jsx("div", { className: "flex min-h-0 flex-1 flex-col gap-1 overflow-y-auto p-2", children: chat.conversations.length === 0 ? /* @__PURE__ */ jsx("p", { className: "p-4 text-center text-muted-foreground text-sm", children: "No conversations yet." }) : chat.conversations.map((conversation) => /* @__PURE__ */ jsxs(
|
|
@@ -2246,7 +2256,9 @@ function AgentWidget({
|
|
|
2246
2256
|
if (!mapping) return;
|
|
2247
2257
|
const args = findToolArguments(messages, latest);
|
|
2248
2258
|
const path = mapping.buildRoute ? mapping.buildRoute(args) : mapping.route;
|
|
2249
|
-
if (path)
|
|
2259
|
+
if (!path) return;
|
|
2260
|
+
const scrollTo = typeof mapping.scrollTo === "function" ? mapping.scrollTo(args) : mapping.scrollTo;
|
|
2261
|
+
config.navigate(path, { scrollTo: scrollTo ?? null });
|
|
2250
2262
|
}, [config, fullscreen, messages, open]);
|
|
2251
2263
|
const closePanel = React11.useCallback(() => {
|
|
2252
2264
|
setOpen(false);
|
|
@@ -2313,6 +2325,7 @@ function AgentWidget({
|
|
|
2313
2325
|
canToggleAgentMode: false,
|
|
2314
2326
|
chat,
|
|
2315
2327
|
className: "flex-1",
|
|
2328
|
+
collapseToSide: true,
|
|
2316
2329
|
config,
|
|
2317
2330
|
newMessageAnchorId: anchorId,
|
|
2318
2331
|
onAlwaysApprove: alwaysApprove.setAlwaysApprove,
|