@copilotkitnext/react 0.0.13-alpha.0 → 0.0.13-alpha.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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/chat/CopilotChatInput.tsx","../src/providers/CopilotChatConfigurationProvider.tsx","../src/components/ui/button.tsx","../src/lib/utils.ts","../src/components/ui/tooltip.tsx","../src/components/ui/dropdown-menu.tsx","../src/components/chat/CopilotChatAudioRecorder.tsx","../src/lib/slots.tsx","../src/components/chat/CopilotChatAssistantMessage.tsx","../src/hooks/use-render-tool-call.tsx","../src/providers/CopilotKitProvider.tsx","../src/hooks/use-frontend-tool.tsx","../src/hooks/use-human-in-the-loop.tsx","../src/hooks/use-agent.tsx","../src/hooks/use-agent-context.tsx","../src/hooks/use-suggestions.tsx","../src/hooks/use-configure-suggestions.tsx","../src/components/chat/CopilotChatToolCallsView.tsx","../src/components/chat/CopilotChatUserMessage.tsx","../src/components/chat/CopilotChatSuggestionPill.tsx","../src/components/chat/CopilotChatSuggestionView.tsx","../src/components/chat/CopilotChatMessageView.tsx","../src/components/chat/CopilotChatView.tsx","../src/components/chat/CopilotChat.tsx","../src/components/chat/CopilotChatToggleButton.tsx","../src/components/chat/CopilotSidebarView.tsx","../src/components/chat/CopilotModalHeader.tsx","../src/components/chat/CopilotSidebar.tsx","../src/types/defineToolCallRender.ts","../src/components/WildcardToolCallRender.tsx"],"sourcesContent":["import React, { useState, useRef, KeyboardEvent, ChangeEvent, useEffect, forwardRef, useImperativeHandle } from \"react\";\nimport { twMerge } from \"tailwind-merge\";\nimport { Plus, Settings2, Mic, ArrowUp, X, Check } from \"lucide-react\";\n\nimport {\n CopilotChatLabels,\n useCopilotChatConfiguration,\n CopilotChatDefaultLabels,\n} from \"@/providers/CopilotChatConfigurationProvider\";\nimport { Button } from \"@/components/ui/button\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"@/components/ui/tooltip\";\nimport {\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuSub,\n DropdownMenuSubTrigger,\n DropdownMenuSubContent,\n DropdownMenuSeparator,\n} from \"@/components/ui/dropdown-menu\";\n\nimport { CopilotChatAudioRecorder } from \"./CopilotChatAudioRecorder\";\nimport { renderSlot, WithSlots } from \"@/lib/slots\";\n\nexport type CopilotChatInputMode = \"input\" | \"transcribe\" | \"processing\";\n\nexport type ToolsMenuItem = {\n label: string;\n} & (\n | {\n action: () => void;\n items?: never;\n }\n | {\n action?: never;\n items: (ToolsMenuItem | \"-\")[];\n }\n);\n\nexport type CopilotChatInputProps = WithSlots<\n {\n textArea: typeof CopilotChatInput.TextArea;\n sendButton: typeof CopilotChatInput.SendButton;\n startTranscribeButton: typeof CopilotChatInput.StartTranscribeButton;\n cancelTranscribeButton: typeof CopilotChatInput.CancelTranscribeButton;\n finishTranscribeButton: typeof CopilotChatInput.FinishTranscribeButton;\n addFileButton: typeof CopilotChatInput.AddFileButton;\n toolsButton: typeof CopilotChatInput.ToolsButton;\n toolbar: typeof CopilotChatInput.Toolbar;\n audioRecorder: typeof CopilotChatAudioRecorder;\n },\n {\n mode?: CopilotChatInputMode;\n toolsMenu?: (ToolsMenuItem | \"-\")[];\n autoFocus?: boolean;\n additionalToolbarItems?: React.ReactNode;\n onSubmitMessage?: (value: string) => void;\n onStartTranscribe?: () => void;\n onCancelTranscribe?: () => void;\n onFinishTranscribe?: () => void;\n onAddFile?: () => void;\n value?: string;\n onChange?: (value: string) => void;\n } & Omit<React.HTMLAttributes<HTMLDivElement>, \"onChange\">\n>;\n\nexport function CopilotChatInput({\n mode = \"input\",\n onSubmitMessage,\n onStartTranscribe,\n onCancelTranscribe,\n onFinishTranscribe,\n onAddFile,\n onChange,\n value,\n toolsMenu,\n autoFocus = true,\n additionalToolbarItems,\n textArea,\n sendButton,\n startTranscribeButton,\n cancelTranscribeButton,\n finishTranscribeButton,\n addFileButton,\n toolsButton,\n toolbar,\n audioRecorder,\n children,\n className,\n ...props\n}: CopilotChatInputProps) {\n const isControlled = value !== undefined;\n const [internalValue, setInternalValue] = useState<string>(() => value ?? \"\");\n\n useEffect(() => {\n if (!isControlled && value !== undefined) {\n setInternalValue(value);\n }\n }, [isControlled, value]);\n\n const resolvedValue = isControlled ? (value ?? \"\") : internalValue;\n\n const inputRef = useRef<HTMLTextAreaElement>(null);\n const audioRecorderRef = useRef<React.ElementRef<typeof CopilotChatAudioRecorder>>(null);\n const config = useCopilotChatConfiguration();\n\n const previousModalStateRef = useRef<boolean | undefined>(undefined);\n\n useEffect(() => {\n if (!autoFocus) {\n previousModalStateRef.current = config?.isModalOpen;\n return;\n }\n\n if (config?.isModalOpen && !previousModalStateRef.current) {\n inputRef.current?.focus();\n }\n\n previousModalStateRef.current = config?.isModalOpen;\n }, [config?.isModalOpen, autoFocus]);\n\n // Handle recording based on mode changes\n useEffect(() => {\n const recorder = audioRecorderRef.current;\n if (!recorder) {\n return;\n }\n\n if (mode === \"transcribe\") {\n // Start recording when entering transcribe mode\n recorder.start().catch(console.error);\n } else {\n // Stop recording when leaving transcribe mode\n if (recorder.state === \"recording\") {\n recorder.stop().catch(console.error);\n }\n }\n }, [mode]);\n\n // Handlers\n const handleChange = (e: ChangeEvent<HTMLTextAreaElement>) => {\n const nextValue = e.target.value;\n if (!isControlled) {\n setInternalValue(nextValue);\n }\n onChange?.(nextValue);\n };\n\n const handleKeyDown = (e: KeyboardEvent<HTMLTextAreaElement>) => {\n if (e.key === \"Enter\" && !e.shiftKey) {\n e.preventDefault();\n send();\n }\n };\n\n const send = () => {\n if (!onSubmitMessage) {\n return;\n }\n const trimmed = resolvedValue.trim();\n if (!trimmed) {\n return;\n }\n\n onSubmitMessage(trimmed);\n\n if (!isControlled) {\n setInternalValue(\"\");\n onChange?.(\"\");\n }\n\n if (inputRef.current) {\n inputRef.current.focus();\n }\n };\n\n const BoundTextArea = renderSlot(textArea, CopilotChatInput.TextArea, {\n ref: inputRef,\n value: resolvedValue,\n onChange: handleChange,\n onKeyDown: handleKeyDown,\n autoFocus: autoFocus,\n });\n\n const BoundAudioRecorder = renderSlot(audioRecorder, CopilotChatAudioRecorder, {\n ref: audioRecorderRef,\n });\n\n const BoundSendButton = renderSlot(sendButton, CopilotChatInput.SendButton, {\n onClick: send,\n disabled: !resolvedValue.trim() || !onSubmitMessage,\n });\n\n const BoundStartTranscribeButton = renderSlot(startTranscribeButton, CopilotChatInput.StartTranscribeButton, {\n onClick: onStartTranscribe,\n });\n\n const BoundCancelTranscribeButton = renderSlot(cancelTranscribeButton, CopilotChatInput.CancelTranscribeButton, {\n onClick: onCancelTranscribe,\n });\n\n const BoundFinishTranscribeButton = renderSlot(finishTranscribeButton, CopilotChatInput.FinishTranscribeButton, {\n onClick: onFinishTranscribe,\n });\n\n const BoundAddFileButton = renderSlot(addFileButton, CopilotChatInput.AddFileButton, {\n onClick: onAddFile,\n disabled: mode === \"transcribe\",\n });\n\n const BoundToolsButton = renderSlot(toolsButton, CopilotChatInput.ToolsButton, {\n disabled: mode === \"transcribe\",\n toolsMenu: toolsMenu,\n });\n\n const BoundToolbar = renderSlot(\n typeof toolbar === \"string\" || toolbar === undefined\n ? twMerge(toolbar, \"w-full h-[60px] bg-transparent flex items-center justify-between\")\n : toolbar,\n CopilotChatInput.Toolbar,\n {\n children: (\n <>\n <div className=\"flex items-center\">\n {onAddFile && BoundAddFileButton}\n {BoundToolsButton}\n {additionalToolbarItems}\n </div>\n <div className=\"flex items-center\">\n {mode === \"transcribe\" ? (\n <>\n {onCancelTranscribe && BoundCancelTranscribeButton}\n {onFinishTranscribe && BoundFinishTranscribeButton}\n </>\n ) : (\n <>\n {onStartTranscribe && BoundStartTranscribeButton}\n {BoundSendButton}\n </>\n )}\n </div>\n </>\n ),\n },\n );\n\n if (children) {\n return (\n <>\n {children({\n textArea: BoundTextArea,\n audioRecorder: BoundAudioRecorder,\n sendButton: BoundSendButton,\n startTranscribeButton: BoundStartTranscribeButton,\n cancelTranscribeButton: BoundCancelTranscribeButton,\n finishTranscribeButton: BoundFinishTranscribeButton,\n addFileButton: BoundAddFileButton,\n toolsButton: BoundToolsButton,\n toolbar: BoundToolbar,\n onSubmitMessage,\n onStartTranscribe,\n onCancelTranscribe,\n onFinishTranscribe,\n onAddFile,\n mode,\n toolsMenu,\n autoFocus,\n additionalToolbarItems,\n })}\n </>\n );\n }\n\n const handleContainerClick = (e: React.MouseEvent<HTMLDivElement>) => {\n // Don't focus if clicking on buttons or other interactive elements\n const target = e.target as HTMLElement;\n if (target.tagName !== \"BUTTON\" && !target.closest(\"button\") && inputRef.current && mode === \"input\") {\n inputRef.current.focus();\n }\n };\n\n return (\n <div\n className={twMerge(\n // Layout\n \"flex w-full flex-col items-center justify-center\",\n // Interaction\n \"cursor-text\",\n // Overflow and clipping\n \"overflow-visible bg-clip-padding contain-inline-size\",\n // Background\n \"bg-white dark:bg-[#303030]\",\n // Visual effects\n \"shadow-[0_4px_4px_0_#0000000a,0_0_1px_0_#0000009e] rounded-[28px]\",\n className,\n )}\n onClick={handleContainerClick}\n {...props}\n >\n {mode === \"transcribe\" ? BoundAudioRecorder : BoundTextArea}\n {BoundToolbar}\n </div>\n );\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace CopilotChatInput {\n export const SendButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement>> = ({ className, ...props }) => (\n <div className=\"mr-[10px]\">\n <Button\n type=\"button\"\n variant=\"chatInputToolbarPrimary\"\n size=\"chatInputToolbarIcon\"\n className={className}\n {...props}\n >\n <ArrowUp className=\"size-[18px]\" />\n </Button>\n </div>\n );\n\n export const ToolbarButton: React.FC<\n React.ButtonHTMLAttributes<HTMLButtonElement> & {\n icon: React.ReactNode;\n labelKey: keyof CopilotChatLabels;\n defaultClassName?: string;\n }\n > = ({ icon, labelKey, defaultClassName, className, ...props }) => {\n const config = useCopilotChatConfiguration();\n const labels = config?.labels ?? CopilotChatDefaultLabels;\n return (\n <Tooltip>\n <TooltipTrigger asChild>\n <Button\n type=\"button\"\n variant=\"chatInputToolbarSecondary\"\n size=\"chatInputToolbarIcon\"\n className={twMerge(defaultClassName, className)}\n {...props}\n >\n {icon}\n </Button>\n </TooltipTrigger>\n <TooltipContent side=\"bottom\">\n <p>{labels[labelKey]}</p>\n </TooltipContent>\n </Tooltip>\n );\n };\n\n export const StartTranscribeButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement>> = (props) => (\n <ToolbarButton\n icon={<Mic className=\"size-[18px]\" />}\n labelKey=\"chatInputToolbarStartTranscribeButtonLabel\"\n defaultClassName=\"mr-2\"\n {...props}\n />\n );\n\n export const CancelTranscribeButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement>> = (props) => (\n <ToolbarButton\n icon={<X className=\"size-[18px]\" />}\n labelKey=\"chatInputToolbarCancelTranscribeButtonLabel\"\n defaultClassName=\"mr-2\"\n {...props}\n />\n );\n\n export const FinishTranscribeButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement>> = (props) => (\n <ToolbarButton\n icon={<Check className=\"size-[18px]\" />}\n labelKey=\"chatInputToolbarFinishTranscribeButtonLabel\"\n defaultClassName=\"mr-[10px]\"\n {...props}\n />\n );\n\n export const AddFileButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement>> = (props) => (\n <ToolbarButton\n icon={<Plus className=\"size-[20px]\" />}\n labelKey=\"chatInputToolbarAddButtonLabel\"\n defaultClassName=\"ml-2\"\n {...props}\n />\n );\n\n export const ToolsButton: React.FC<\n React.ButtonHTMLAttributes<HTMLButtonElement> & {\n toolsMenu?: (ToolsMenuItem | \"-\")[];\n }\n > = ({ className, toolsMenu, ...props }) => {\n const config = useCopilotChatConfiguration();\n const labels = config?.labels ?? CopilotChatDefaultLabels;\n\n const renderMenuItems = (items: (ToolsMenuItem | \"-\")[]): React.ReactNode => {\n return items.map((item, index) => {\n if (item === \"-\") {\n // Separator\n return <DropdownMenuSeparator key={index} />;\n } else if (item.items && item.items.length > 0) {\n // Nested menu\n return (\n <DropdownMenuSub key={index}>\n <DropdownMenuSubTrigger>{item.label}</DropdownMenuSubTrigger>\n <DropdownMenuSubContent>{renderMenuItems(item.items)}</DropdownMenuSubContent>\n </DropdownMenuSub>\n );\n } else {\n // Regular menu item\n return (\n <DropdownMenuItem key={index} onClick={item.action}>\n {item.label}\n </DropdownMenuItem>\n );\n }\n });\n };\n\n // Only render if toolsMenu is provided and has items\n if (!toolsMenu || toolsMenu.length === 0) {\n return null;\n }\n\n // Render dropdown menu\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button\n type=\"button\"\n variant=\"chatInputToolbarSecondary\"\n size=\"chatInputToolbarIconLabel\"\n className={className}\n {...props}\n >\n <Settings2 className=\"size-[18px]\" />\n <span className=\"text-sm font-normal\">{labels.chatInputToolbarToolsButtonLabel}</span>\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent side=\"top\" align=\"end\">\n {renderMenuItems(toolsMenu)}\n </DropdownMenuContent>\n </DropdownMenu>\n );\n };\n\n export const Toolbar: React.FC<React.HTMLAttributes<HTMLDivElement>> = ({ className, ...props }) => (\n <div className={twMerge(\"w-full h-[60px] bg-transparent flex items-center\", className)} {...props} />\n );\n\n export interface TextAreaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {\n maxRows?: number;\n }\n\n export const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(function TextArea(\n { maxRows = 5, style, className, ...props },\n ref,\n ) {\n const internalTextareaRef = useRef<HTMLTextAreaElement>(null);\n const [maxHeight, setMaxHeight] = useState<number>(0);\n\n const config = useCopilotChatConfiguration();\n const labels = config?.labels ?? CopilotChatDefaultLabels;\n\n useImperativeHandle(ref, () => internalTextareaRef.current as HTMLTextAreaElement);\n\n const adjustHeight = () => {\n const textarea = internalTextareaRef.current;\n if (textarea && maxHeight > 0) {\n textarea.style.height = \"auto\";\n textarea.style.height = `${Math.min(textarea.scrollHeight, maxHeight)}px`;\n }\n };\n\n useEffect(() => {\n const calculateMaxHeight = () => {\n const textarea = internalTextareaRef.current;\n if (textarea) {\n // Save current value\n const currentValue = textarea.value;\n // Clear content to measure single row height\n textarea.value = \"\";\n textarea.style.height = \"auto\";\n\n // Get computed styles to account for padding\n const computedStyle = window.getComputedStyle(textarea);\n const paddingTop = parseFloat(computedStyle.paddingTop);\n const paddingBottom = parseFloat(computedStyle.paddingBottom);\n\n // Calculate actual content height (without padding)\n const contentHeight = textarea.scrollHeight - paddingTop - paddingBottom;\n\n // Calculate max height: content height for maxRows + padding\n setMaxHeight(contentHeight * maxRows + paddingTop + paddingBottom);\n\n // Restore original value\n textarea.value = currentValue;\n\n // Adjust height after calculating maxHeight\n if (currentValue) {\n textarea.style.height = \"auto\";\n textarea.style.height = `${Math.min(textarea.scrollHeight, contentHeight * maxRows + paddingTop + paddingBottom)}px`;\n }\n\n if (props.autoFocus) {\n textarea.focus();\n }\n }\n };\n\n calculateMaxHeight();\n }, [maxRows, props.autoFocus]);\n\n // Adjust height when controlled value changes\n useEffect(() => {\n adjustHeight();\n }, [props.value, maxHeight]);\n\n // Handle input events for uncontrolled usage\n const handleInput = (e: React.FormEvent<HTMLTextAreaElement>) => {\n adjustHeight();\n // Call the original onChange if provided\n if (props.onChange) {\n props.onChange(e as React.ChangeEvent<HTMLTextAreaElement>);\n }\n };\n\n return (\n <textarea\n ref={internalTextareaRef}\n {...props}\n onChange={handleInput}\n style={{\n overflow: \"auto\",\n resize: \"none\",\n maxHeight: `${maxHeight}px`,\n ...style,\n }}\n placeholder={labels.chatInputPlaceholder}\n className={twMerge(\n // Layout and sizing\n \"w-full p-5 pb-0\",\n // Behavior\n \"outline-none resize-none\",\n // Background\n \"bg-transparent\",\n // Typography\n \"antialiased font-regular leading-relaxed text-[16px]\",\n // Placeholder styles\n \"placeholder:text-[#00000077] dark:placeholder:text-[#fffc]\",\n className,\n )}\n rows={1}\n />\n );\n });\n\n export const AudioRecorder = CopilotChatAudioRecorder;\n}\n\nCopilotChatInput.TextArea.displayName = \"CopilotChatInput.TextArea\";\nCopilotChatInput.SendButton.displayName = \"CopilotChatInput.SendButton\";\nCopilotChatInput.ToolbarButton.displayName = \"CopilotChatInput.ToolbarButton\";\nCopilotChatInput.StartTranscribeButton.displayName = \"CopilotChatInput.StartTranscribeButton\";\nCopilotChatInput.CancelTranscribeButton.displayName = \"CopilotChatInput.CancelTranscribeButton\";\nCopilotChatInput.FinishTranscribeButton.displayName = \"CopilotChatInput.FinishTranscribeButton\";\nCopilotChatInput.AddFileButton.displayName = \"CopilotChatInput.AddButton\";\nCopilotChatInput.ToolsButton.displayName = \"CopilotChatInput.ToolsButton\";\nCopilotChatInput.Toolbar.displayName = \"CopilotChatInput.Toolbar\";\n\nexport default CopilotChatInput;\n","import React, { createContext, useContext, ReactNode, useMemo, useState } from \"react\";\nimport { DEFAULT_AGENT_ID, randomUUID } from \"@copilotkitnext/shared\";\n\n// Default labels\nexport const CopilotChatDefaultLabels = {\n chatInputPlaceholder: \"Type a message...\",\n chatInputToolbarStartTranscribeButtonLabel: \"Transcribe\",\n chatInputToolbarCancelTranscribeButtonLabel: \"Cancel\",\n chatInputToolbarFinishTranscribeButtonLabel: \"Finish\",\n chatInputToolbarAddButtonLabel: \"Add photos or files\",\n chatInputToolbarToolsButtonLabel: \"Tools\",\n assistantMessageToolbarCopyCodeLabel: \"Copy\",\n assistantMessageToolbarCopyCodeCopiedLabel: \"Copied\",\n assistantMessageToolbarCopyMessageLabel: \"Copy\",\n assistantMessageToolbarThumbsUpLabel: \"Good response\",\n assistantMessageToolbarThumbsDownLabel: \"Bad response\",\n assistantMessageToolbarReadAloudLabel: \"Read aloud\",\n assistantMessageToolbarRegenerateLabel: \"Regenerate\",\n userMessageToolbarCopyMessageLabel: \"Copy\",\n userMessageToolbarEditMessageLabel: \"Edit\",\n chatDisclaimerText: \"AI can make mistakes. Please verify important information.\",\n chatToggleOpenLabel: \"Open chat\",\n chatToggleCloseLabel: \"Close chat\",\n modalHeaderTitle: \"CopilotKit Chat\",\n};\n\nexport type CopilotChatLabels = typeof CopilotChatDefaultLabels;\n\n// Define the full configuration interface\nexport interface CopilotChatConfigurationValue {\n labels: CopilotChatLabels;\n agentId: string;\n threadId: string;\n isModalOpen: boolean;\n setModalOpen: (open: boolean) => void;\n isModalDefaultOpen: boolean;\n}\n\n// Create the configuration context\nconst CopilotChatConfiguration =\n createContext<CopilotChatConfigurationValue | null>(null);\n\n// Provider props interface\nexport interface CopilotChatConfigurationProviderProps {\n children: ReactNode;\n labels?: Partial<CopilotChatLabels>;\n agentId?: string;\n threadId?: string;\n isModalDefaultOpen?: boolean;\n}\n\n// Provider component\nexport const CopilotChatConfigurationProvider: React.FC<\n CopilotChatConfigurationProviderProps\n> = ({ children, labels, agentId, threadId, isModalDefaultOpen }) => {\n const parentConfig = useContext(CopilotChatConfiguration);\n\n const mergedLabels: CopilotChatLabels = useMemo(\n () => ({\n ...CopilotChatDefaultLabels,\n ...(parentConfig?.labels ?? {}),\n ...(labels ?? {}),\n }),\n [labels, parentConfig?.labels],\n );\n\n const resolvedAgentId = agentId ?? parentConfig?.agentId ?? DEFAULT_AGENT_ID;\n\n const resolvedThreadId = useMemo(() => {\n if (threadId) {\n return threadId;\n }\n if (parentConfig?.threadId) {\n return parentConfig.threadId;\n }\n return randomUUID();\n }, [threadId, parentConfig?.threadId]);\n\n const resolvedDefaultOpen = isModalDefaultOpen ?? parentConfig?.isModalDefaultOpen ?? true;\n\n const [internalModalOpen, setInternalModalOpen] = useState<boolean>(\n parentConfig?.isModalOpen ?? resolvedDefaultOpen,\n );\n\n const resolvedIsModalOpen = parentConfig?.isModalOpen ?? internalModalOpen;\n const resolvedSetModalOpen = parentConfig?.setModalOpen ?? setInternalModalOpen;\n\n const configurationValue: CopilotChatConfigurationValue = useMemo(\n () => ({\n labels: mergedLabels,\n agentId: resolvedAgentId,\n threadId: resolvedThreadId,\n isModalOpen: resolvedIsModalOpen,\n setModalOpen: resolvedSetModalOpen,\n isModalDefaultOpen: resolvedDefaultOpen,\n }),\n [\n mergedLabels,\n resolvedAgentId,\n resolvedThreadId,\n resolvedIsModalOpen,\n resolvedSetModalOpen,\n resolvedDefaultOpen,\n ],\n );\n\n return (\n <CopilotChatConfiguration.Provider value={configurationValue}>\n {children}\n </CopilotChatConfiguration.Provider>\n );\n};\n\n// Hook to use the full configuration\nexport const useCopilotChatConfiguration =\n (): CopilotChatConfigurationValue | null => {\n const configuration = useContext(CopilotChatConfiguration);\n return configuration;\n };\n","import * as React from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"@/lib/utils\";\n\nconst buttonVariants = cva(\n \"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive\",\n {\n variants: {\n variant: {\n default:\n \"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90\",\n destructive:\n \"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60\",\n outline:\n \"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50\",\n secondary:\n \"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80\",\n ghost:\n \"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50 cursor-pointer\",\n link: \"text-primary underline-offset-4 hover:underline\",\n assistantMessageToolbarButton: [\n \"cursor-pointer\",\n // Background and text\n \"p-0 text-[rgb(93,93,93)] hover:bg-[#E8E8E8]\",\n // Dark mode - lighter gray for better contrast\n \"dark:text-[rgb(243,243,243)] dark:hover:bg-[#303030]\",\n // Shape and sizing\n \"h-8 w-8\",\n // Interactions\n \"transition-colors\",\n // Hover states\n \"hover:text-[rgb(93,93,93)]\",\n \"dark:hover:text-[rgb(243,243,243)]\",\n ],\n chatInputToolbarPrimary: [\n \"cursor-pointer\",\n // Background and text\n \"bg-black text-white\",\n // Dark mode\n \"dark:bg-white dark:text-black dark:focus-visible:outline-white\",\n // Shape and sizing\n \"rounded-full\",\n // Interactions\n \"transition-colors\",\n // Focus states\n \"focus:outline-none\",\n // Hover states\n \"hover:opacity-70 disabled:hover:opacity-100\",\n // Disabled states\n \"disabled:cursor-not-allowed disabled:bg-[#00000014] disabled:text-[rgb(13,13,13)]\",\n \"dark:disabled:bg-[#454545] dark:disabled:text-white \",\n ],\n chatInputToolbarSecondary: [\n \"cursor-pointer\",\n // Background and text\n \"bg-transparent text-[#444444]\",\n // Dark mode\n \"dark:text-white dark:border-[#404040]\",\n // Shape and sizing\n \"rounded-full\",\n // Interactions\n \"transition-colors\",\n // Focus states\n \"focus:outline-none\",\n // Hover states\n \"hover:bg-[#f8f8f8] hover:text-[#333333]\",\n \"dark:hover:bg-[#404040] dark:hover:text-[#FFFFFF]\",\n // Disabled states\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n \"disabled:hover:bg-transparent disabled:hover:text-[#444444]\",\n \"dark:disabled:hover:bg-transparent dark:disabled:hover:text-[#CCCCCC]\",\n ],\n },\n size: {\n default: \"h-9 px-4 py-2 has-[>svg]:px-3\",\n sm: \"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5\",\n lg: \"h-10 rounded-md px-6 has-[>svg]:px-4\",\n icon: \"size-9\",\n chatInputToolbarIcon: [\n // Shape and sizing\n \"h-9 w-9 rounded-full\",\n ],\n chatInputToolbarIconLabel: [\n // Shape and sizing\n \"h-9 px-3 rounded-full\",\n // Layout\n \"gap-2\",\n // Typography\n \"font-normal\",\n ],\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n }\n);\n\nfunction Button({\n className,\n variant,\n size,\n asChild = false,\n ...props\n}: React.ComponentProps<\"button\"> &\n VariantProps<typeof buttonVariants> & {\n asChild?: boolean;\n }) {\n const Comp = asChild ? Slot : \"button\";\n\n return (\n <Comp\n data-slot=\"button\"\n className={cn(buttonVariants({ variant, size, className }))}\n {...props}\n />\n );\n}\n\nexport { Button, buttonVariants };\n","import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","import * as React from \"react\";\nimport * as TooltipPrimitive from \"@radix-ui/react-tooltip\";\n\nimport { cn } from \"@/lib/utils\";\n\nfunction TooltipProvider({\n delayDuration = 0,\n ...props\n}: React.ComponentProps<typeof TooltipPrimitive.Provider>) {\n return (\n <TooltipPrimitive.Provider\n data-slot=\"tooltip-provider\"\n delayDuration={delayDuration}\n {...props}\n />\n );\n}\n\nfunction Tooltip({\n ...props\n}: React.ComponentProps<typeof TooltipPrimitive.Root>) {\n return (\n <TooltipProvider>\n <TooltipPrimitive.Root data-slot=\"tooltip\" {...props} />\n </TooltipProvider>\n );\n}\n\nfunction TooltipTrigger({\n ...props\n}: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {\n return <TooltipPrimitive.Trigger data-slot=\"tooltip-trigger\" {...props} />;\n}\n\nfunction TooltipContent({\n className,\n sideOffset = 0,\n children,\n ...props\n}: React.ComponentProps<typeof TooltipPrimitive.Content>) {\n return (\n <TooltipPrimitive.Portal>\n <TooltipPrimitive.Content\n data-slot=\"tooltip-content\"\n sideOffset={sideOffset}\n className={cn(\n \"bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance\",\n className\n )}\n {...props}\n >\n {children}\n <TooltipPrimitive.Arrow className=\"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]\" />\n </TooltipPrimitive.Content>\n </TooltipPrimitive.Portal>\n );\n}\n\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };\n","\"use client\"\n\nimport * as React from \"react\"\nimport * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\"\nimport { CheckIcon, ChevronRightIcon, CircleIcon } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction DropdownMenu({\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Root>) {\n return <DropdownMenuPrimitive.Root data-slot=\"dropdown-menu\" {...props} />\n}\n\nfunction DropdownMenuPortal({\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>) {\n return (\n <DropdownMenuPrimitive.Portal data-slot=\"dropdown-menu-portal\" {...props} />\n )\n}\n\nfunction DropdownMenuTrigger({\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>) {\n return (\n <DropdownMenuPrimitive.Trigger\n data-slot=\"dropdown-menu-trigger\"\n {...props}\n />\n )\n}\n\nfunction DropdownMenuContent({\n className,\n sideOffset = 4,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Content>) {\n return (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n data-slot=\"dropdown-menu-content\"\n sideOffset={sideOffset}\n className={cn(\n \"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md\",\n className\n )}\n {...props}\n />\n </DropdownMenuPrimitive.Portal>\n )\n}\n\nfunction DropdownMenuGroup({\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Group>) {\n return (\n <DropdownMenuPrimitive.Group data-slot=\"dropdown-menu-group\" {...props} />\n )\n}\n\nfunction DropdownMenuItem({\n className,\n inset,\n variant = \"default\",\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {\n inset?: boolean\n variant?: \"default\" | \"destructive\"\n}) {\n return (\n <DropdownMenuPrimitive.Item\n data-slot=\"dropdown-menu-item\"\n data-inset={inset}\n data-variant={variant}\n className={cn(\n \"focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuCheckboxItem({\n className,\n children,\n checked,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>) {\n return (\n <DropdownMenuPrimitive.CheckboxItem\n data-slot=\"dropdown-menu-checkbox-item\"\n className={cn(\n \"focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className\n )}\n checked={checked}\n {...props}\n >\n <span className=\"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <CheckIcon className=\"size-4\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.CheckboxItem>\n )\n}\n\nfunction DropdownMenuRadioGroup({\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>) {\n return (\n <DropdownMenuPrimitive.RadioGroup\n data-slot=\"dropdown-menu-radio-group\"\n {...props}\n />\n )\n}\n\nfunction DropdownMenuRadioItem({\n className,\n children,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>) {\n return (\n <DropdownMenuPrimitive.RadioItem\n data-slot=\"dropdown-menu-radio-item\"\n className={cn(\n \"focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className\n )}\n {...props}\n >\n <span className=\"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <CircleIcon className=\"size-2 fill-current\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.RadioItem>\n )\n}\n\nfunction DropdownMenuLabel({\n className,\n inset,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {\n inset?: boolean\n}) {\n return (\n <DropdownMenuPrimitive.Label\n data-slot=\"dropdown-menu-label\"\n data-inset={inset}\n className={cn(\n \"px-2 py-1.5 text-sm font-medium data-[inset]:pl-8\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>) {\n return (\n <DropdownMenuPrimitive.Separator\n data-slot=\"dropdown-menu-separator\"\n className={cn(\"bg-border -mx-1 my-1 h-px\", className)}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuShortcut({\n className,\n ...props\n}: React.ComponentProps<\"span\">) {\n return (\n <span\n data-slot=\"dropdown-menu-shortcut\"\n className={cn(\n \"text-muted-foreground ml-auto text-xs tracking-widest\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuSub({\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>) {\n return <DropdownMenuPrimitive.Sub data-slot=\"dropdown-menu-sub\" {...props} />\n}\n\nfunction DropdownMenuSubTrigger({\n className,\n inset,\n children,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {\n inset?: boolean\n}) {\n return (\n <DropdownMenuPrimitive.SubTrigger\n data-slot=\"dropdown-menu-sub-trigger\"\n data-inset={inset}\n className={cn(\n \"focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8\",\n className\n )}\n {...props}\n >\n {children}\n <ChevronRightIcon className=\"ml-auto size-4\" />\n </DropdownMenuPrimitive.SubTrigger>\n )\n}\n\nfunction DropdownMenuSubContent({\n className,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>) {\n return (\n <DropdownMenuPrimitive.SubContent\n data-slot=\"dropdown-menu-sub-content\"\n className={cn(\n \"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n DropdownMenu,\n DropdownMenuPortal,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuLabel,\n DropdownMenuItem,\n DropdownMenuCheckboxItem,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuSub,\n DropdownMenuSubTrigger,\n DropdownMenuSubContent,\n}\n","import { useRef, useEffect, useImperativeHandle, forwardRef } from \"react\";\nimport { twMerge } from \"tailwind-merge\";\n\n/** Finite-state machine for every recorder implementation */\nexport type AudioRecorderState = \"idle\" | \"recording\" | \"processing\";\n\n/** Error subclass so callers can `instanceof`-guard recorder failures */\nexport class AudioRecorderError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"AudioRecorderError\";\n }\n}\n\nexport const CopilotChatAudioRecorder = forwardRef<\n any,\n React.HTMLAttributes<HTMLDivElement>\n>((props, ref) => {\n const { className, ...divProps } = props;\n const canvasRef = useRef<HTMLCanvasElement>(null);\n\n // Generate fake waveform that moves with time\n const getLoudness = (n: number): number[] => {\n const elapsed = Date.now() / 1000; // Use current timestamp directly\n const samples: number[] = [];\n\n for (let i = 0; i < n; i++) {\n // Create a position that moves from left to right over time\n const position = (i / n) * 10 + elapsed * 0.5; // Scroll speed (slower)\n\n // Generate waveform using multiple sine waves for realism\n const wave1 = Math.sin(position * 2) * 0.3;\n const wave2 = Math.sin(position * 5 + elapsed) * 0.2;\n const wave3 = Math.sin(position * 0.5 + elapsed * 0.3) * 0.4;\n\n // Add some randomness for natural variation\n const noise = (Math.random() - 0.5) * 0.1;\n\n // Combine waves and add envelope for realistic amplitude variation\n const envelope = Math.sin(elapsed * 0.7) * 0.5 + 0.5; // Slow amplitude modulation\n let amplitude = (wave1 + wave2 + wave3 + noise) * envelope;\n\n // Clamp to 0-1 range\n amplitude = Math.max(0, Math.min(1, amplitude * 0.5 + 0.3));\n\n samples.push(amplitude);\n }\n\n return samples;\n };\n\n // No setup needed - stub implementation\n\n // Canvas rendering with 60fps animation\n useEffect(() => {\n const canvas = canvasRef.current;\n if (!canvas) return;\n\n const ctx = canvas.getContext(\"2d\");\n if (!ctx) return;\n\n let animationId: number;\n\n const draw = () => {\n const rect = canvas.getBoundingClientRect();\n const dpr = window.devicePixelRatio || 1;\n\n // Update canvas dimensions if container resized\n if (\n canvas.width !== rect.width * dpr ||\n canvas.height !== rect.height * dpr\n ) {\n canvas.width = rect.width * dpr;\n canvas.height = rect.height * dpr;\n ctx.scale(dpr, dpr);\n ctx.imageSmoothingEnabled = false;\n }\n\n // Configuration\n const barWidth = 2;\n const minHeight = 2;\n const maxHeight = 20;\n const gap = 2;\n const numSamples = Math.ceil(rect.width / (barWidth + gap));\n\n // Get loudness data\n const loudnessData = getLoudness(numSamples);\n\n // Clear canvas\n ctx.clearRect(0, 0, rect.width, rect.height);\n\n // Get current foreground color\n const computedStyle = getComputedStyle(canvas);\n const currentForeground = computedStyle.color;\n\n // Draw bars\n ctx.fillStyle = currentForeground;\n const centerY = rect.height / 2;\n\n for (let i = 0; i < loudnessData.length; i++) {\n const sample = loudnessData[i] ?? 0;\n const barHeight = Math.round(\n sample * (maxHeight - minHeight) + minHeight\n );\n const x = Math.round(i * (barWidth + gap));\n const y = Math.round(centerY - barHeight / 2);\n\n ctx.fillRect(x, y, barWidth, barHeight);\n }\n\n animationId = requestAnimationFrame(draw);\n };\n\n draw();\n\n return () => {\n if (animationId) {\n cancelAnimationFrame(animationId);\n }\n };\n }, []);\n\n // Expose AudioRecorder API\n useImperativeHandle(\n ref,\n () => ({\n get state() {\n return \"idle\" as AudioRecorderState;\n },\n start: async () => {\n // Stub implementation - no actual recording\n },\n stop: () =>\n new Promise<Blob>((resolve) => {\n // Stub implementation - return empty blob\n const emptyBlob = new Blob([], { type: \"audio/webm\" });\n resolve(emptyBlob);\n }),\n dispose: () => {\n // No cleanup needed\n },\n }),\n []\n );\n\n return (\n <div className={twMerge(\"h-[44px] w-full px-5\", className)} {...divProps}>\n <canvas\n ref={canvasRef}\n className=\"w-full h-full\"\n style={{ imageRendering: \"pixelated\" }}\n />\n </div>\n );\n});\n\nCopilotChatAudioRecorder.displayName = \"WebAudioRecorder\";\n","import React from \"react\";\n\n// /** Utility: Create a component type with specific props omitted */\n// export type OmitSlotProps<\n// C extends React.ComponentType<any>,\n// K extends keyof React.ComponentProps<C>,\n// > = React.ComponentType<Omit<React.ComponentProps<C>, K>>;\n\n/** Existing union (unchanged) */\nexport type SlotValue<C extends React.ComponentType<any>> =\n | C\n | string\n | Partial<React.ComponentProps<C>>;\n\n/** Utility: concrete React elements for every slot */\ntype SlotElements<S> = { [K in keyof S]: React.ReactElement };\n\nexport type WithSlots<\n S extends Record<string, React.ComponentType<any>>,\n Rest = {},\n> = {\n /** Per‑slot overrides */\n [K in keyof S]?: SlotValue<S[K]>;\n} & {\n children?: (props: SlotElements<S> & Rest) => React.ReactNode;\n} & Omit<Rest, \"children\">;\n\nexport function renderSlot<\n C extends React.ComponentType<any>,\n P = React.ComponentProps<C>,\n>(\n slot: SlotValue<C> | undefined,\n DefaultComponent: C,\n props: P\n): React.ReactElement {\n if (typeof slot === \"string\") {\n return React.createElement(DefaultComponent, {\n ...(props as P),\n className: slot,\n });\n }\n if (typeof slot === \"function\") {\n const Comp = slot as C;\n return React.createElement(Comp, props as P);\n }\n\n if (slot && typeof slot === \"object\" && !React.isValidElement(slot)) {\n return React.createElement(DefaultComponent, {\n ...(props as P),\n ...slot,\n });\n }\n\n return React.createElement(DefaultComponent, props as P);\n}\n","import { AssistantMessage, Message } from \"@ag-ui/core\";\nimport { MarkdownHooks } from \"react-markdown\";\nimport remarkGfm from \"remark-gfm\";\nimport remarkMath from \"remark-math\";\nimport rehypePrettyCode from \"rehype-pretty-code\";\nimport rehypeKatex from \"rehype-katex\";\nimport { useState } from \"react\";\nimport {\n Copy,\n Check,\n ThumbsUp,\n ThumbsDown,\n Volume2,\n RefreshCw,\n} from \"lucide-react\";\nimport { cn } from \"@/lib/utils\";\nimport {\n useCopilotChatConfiguration,\n CopilotChatDefaultLabels,\n} from \"@/providers/CopilotChatConfigurationProvider\";\nimport { twMerge } from \"tailwind-merge\";\nimport { Button } from \"@/components/ui/button\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from \"@/components/ui/tooltip\";\nimport \"katex/dist/katex.min.css\";\nimport { WithSlots, renderSlot } from \"@/lib/slots\";\nimport { completePartialMarkdown } from \"@copilotkitnext/core\";\nimport CopilotChatToolCallsView from \"./CopilotChatToolCallsView\";\n\nexport type CopilotChatAssistantMessageProps = WithSlots<\n {\n markdownRenderer: typeof CopilotChatAssistantMessage.MarkdownRenderer;\n toolbar: typeof CopilotChatAssistantMessage.Toolbar;\n copyButton: typeof CopilotChatAssistantMessage.CopyButton;\n thumbsUpButton: typeof CopilotChatAssistantMessage.ThumbsUpButton;\n thumbsDownButton: typeof CopilotChatAssistantMessage.ThumbsDownButton;\n readAloudButton: typeof CopilotChatAssistantMessage.ReadAloudButton;\n regenerateButton: typeof CopilotChatAssistantMessage.RegenerateButton;\n toolCallsView: typeof CopilotChatToolCallsView;\n },\n {\n onThumbsUp?: (message: AssistantMessage) => void;\n onThumbsDown?: (message: AssistantMessage) => void;\n onReadAloud?: (message: AssistantMessage) => void;\n onRegenerate?: (message: AssistantMessage) => void;\n message: AssistantMessage;\n messages?: Message[];\n isRunning?: boolean;\n additionalToolbarItems?: React.ReactNode;\n toolbarVisible?: boolean;\n } & React.HTMLAttributes<HTMLDivElement>\n>;\n\nexport function CopilotChatAssistantMessage({\n message,\n messages,\n isRunning,\n onThumbsUp,\n onThumbsDown,\n onReadAloud,\n onRegenerate,\n additionalToolbarItems,\n toolbarVisible = true,\n markdownRenderer,\n toolbar,\n copyButton,\n thumbsUpButton,\n thumbsDownButton,\n readAloudButton,\n regenerateButton,\n toolCallsView,\n children,\n className,\n ...props\n}: CopilotChatAssistantMessageProps) {\n const boundMarkdownRenderer = renderSlot(\n markdownRenderer,\n CopilotChatAssistantMessage.MarkdownRenderer,\n {\n content: message.content || \"\",\n }\n );\n\n const boundCopyButton = renderSlot(\n copyButton,\n CopilotChatAssistantMessage.CopyButton,\n {\n onClick: async () => {\n if (message.content) {\n try {\n await navigator.clipboard.writeText(message.content);\n } catch (err) {\n console.error(\"Failed to copy message:\", err);\n }\n }\n },\n }\n );\n\n const boundThumbsUpButton = renderSlot(\n thumbsUpButton,\n CopilotChatAssistantMessage.ThumbsUpButton,\n {\n onClick: onThumbsUp,\n }\n );\n\n const boundThumbsDownButton = renderSlot(\n thumbsDownButton,\n CopilotChatAssistantMessage.ThumbsDownButton,\n {\n onClick: onThumbsDown,\n }\n );\n\n const boundReadAloudButton = renderSlot(\n readAloudButton,\n CopilotChatAssistantMessage.ReadAloudButton,\n {\n onClick: onReadAloud,\n }\n );\n\n const boundRegenerateButton = renderSlot(\n regenerateButton,\n CopilotChatAssistantMessage.RegenerateButton,\n {\n onClick: onRegenerate,\n }\n );\n\n const boundToolbar = renderSlot(\n toolbar,\n CopilotChatAssistantMessage.Toolbar,\n {\n children: (\n <div className=\"flex items-center gap-1\">\n {boundCopyButton}\n {(onThumbsUp || thumbsUpButton) && boundThumbsUpButton}\n {(onThumbsDown || thumbsDownButton) && boundThumbsDownButton}\n {(onReadAloud || readAloudButton) && boundReadAloudButton}\n {(onRegenerate || regenerateButton) && boundRegenerateButton}\n {additionalToolbarItems}\n </div>\n ),\n }\n );\n\n const boundToolCallsView = renderSlot(\n toolCallsView,\n CopilotChatToolCallsView,\n {\n message,\n messages,\n }\n );\n\n // Don't show toolbar if message has no content (only tool calls)\n const hasContent = !!(message.content && message.content.trim().length > 0);\n const shouldShowToolbar = toolbarVisible && hasContent;\n\n if (children) {\n return (\n <>\n {children({\n markdownRenderer: boundMarkdownRenderer,\n toolbar: boundToolbar,\n toolCallsView: boundToolCallsView,\n copyButton: boundCopyButton,\n thumbsUpButton: boundThumbsUpButton,\n thumbsDownButton: boundThumbsDownButton,\n readAloudButton: boundReadAloudButton,\n regenerateButton: boundRegenerateButton,\n message,\n messages,\n isRunning,\n onThumbsUp,\n onThumbsDown,\n onReadAloud,\n onRegenerate,\n additionalToolbarItems,\n toolbarVisible: shouldShowToolbar,\n })}\n </>\n );\n }\n\n return (\n <div\n className={twMerge(\n \"prose max-w-full break-words dark:prose-invert\",\n className\n )}\n {...props}\n data-message-id={message.id}\n >\n {boundMarkdownRenderer}\n {boundToolCallsView}\n {shouldShowToolbar && boundToolbar}\n </div>\n );\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace CopilotChatAssistantMessage {\n const InlineCode = ({\n children,\n ...props\n }: React.HTMLAttributes<HTMLElement>) => {\n return (\n <code\n className=\"px-[4.8px] py-[2.5px] bg-[rgb(236,236,236)] dark:bg-gray-800 rounded text-sm font-mono font-medium! text-foreground!\"\n {...props}\n >\n {children}\n </code>\n );\n };\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const CodeBlock = ({ children, className, onClick, ...props }: any) => {\n const config = useCopilotChatConfiguration();\n const labels = config?.labels ?? CopilotChatDefaultLabels;\n const [copied, setCopied] = useState(false);\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const getCodeContent = (node: any): string => {\n if (typeof node === \"string\") return node;\n if (Array.isArray(node)) return node.map(getCodeContent).join(\"\");\n if (node?.props?.children) return getCodeContent(node.props.children);\n return \"\";\n };\n\n const codeContent = getCodeContent(children);\n const language = props[\"data-language\"] as string | undefined;\n\n const copyToClipboard = async () => {\n if (!codeContent.trim()) return;\n\n try {\n setCopied(true);\n setTimeout(() => setCopied(false), 2000);\n if (onClick) {\n onClick();\n }\n } catch (err) {\n console.error(\"Failed to copy code:\", err);\n }\n };\n\n return (\n <div className=\"relative\">\n <div className=\"flex items-center justify-between px-4 pr-3 py-3 text-xs\">\n {language && (\n <span className=\"font-regular text-muted-foreground dark:text-white\">\n {language}\n </span>\n )}\n\n <button\n className={cn(\n \"px-2 gap-0.5 text-xs flex items-center cursor-pointer text-muted-foreground dark:text-white\"\n )}\n onClick={copyToClipboard}\n title={\n copied\n ? labels.assistantMessageToolbarCopyCodeCopiedLabel\n : `${labels.assistantMessageToolbarCopyCodeLabel} code`\n }\n >\n {copied ? (\n <Check className=\"h-[10px]! w-[10px]!\" />\n ) : (\n <Copy className=\"h-[10px]! w-[10px]!\" />\n )}\n <span className=\"text-[11px]\">\n {copied\n ? labels.assistantMessageToolbarCopyCodeCopiedLabel\n : labels.assistantMessageToolbarCopyCodeLabel}\n </span>\n </button>\n </div>\n\n <pre\n className={cn(\n className,\n \"rounded-2xl bg-transparent border-t-0 my-1!\"\n )}\n {...props}\n >\n {children}\n </pre>\n </div>\n );\n };\n\n export const MarkdownRenderer: React.FC<\n React.HTMLAttributes<HTMLDivElement> & { content: string }\n > = ({ content, className }) => (\n <div className={className}>\n <MarkdownHooks\n /* async plugins are now fine ✨ */\n remarkPlugins={[remarkGfm, remarkMath]}\n rehypePlugins={[\n [\n rehypePrettyCode,\n {\n keepBackground: false,\n theme: {\n dark: \"one-dark-pro\",\n light: \"one-light\",\n },\n bypassInlineCode: true,\n },\n ],\n rehypeKatex,\n ]}\n components={{\n pre: CodeBlock,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n code: ({ className, children, ...props }: any) => {\n // For inline code, use custom styling\n if (typeof children === \"string\") {\n return <InlineCode {...props}>{children}</InlineCode>;\n }\n\n // For code blocks, just return the code element as-is\n return (\n <code className={className} {...props}>\n {children}\n </code>\n );\n },\n }}\n >\n {completePartialMarkdown(content || \"\")}\n </MarkdownHooks>\n </div>\n );\n\n export const Toolbar: React.FC<React.HTMLAttributes<HTMLDivElement>> = ({\n className,\n ...props\n }) => (\n <div\n className={twMerge(\n \"w-full bg-transparent flex items-center -ml-[5px] -mt-[0px]\",\n className\n )}\n {...props}\n />\n );\n\n export const ToolbarButton: React.FC<\n React.ButtonHTMLAttributes<HTMLButtonElement> & {\n title: string;\n children: React.ReactNode;\n }\n > = ({ title, children, ...props }) => {\n return (\n <Tooltip>\n <TooltipTrigger asChild>\n <Button\n type=\"button\"\n variant=\"assistantMessageToolbarButton\"\n aria-label={title}\n {...props}\n >\n {children}\n </Button>\n </TooltipTrigger>\n <TooltipContent side=\"bottom\">\n <p>{title}</p>\n </TooltipContent>\n </Tooltip>\n );\n };\n\n export const CopyButton: React.FC<\n React.ButtonHTMLAttributes<HTMLButtonElement>\n > = ({ className, title, onClick, ...props }) => {\n const config = useCopilotChatConfiguration();\n const labels = config?.labels ?? CopilotChatDefaultLabels;\n const [copied, setCopied] = useState(false);\n\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n setCopied(true);\n setTimeout(() => setCopied(false), 2000);\n\n if (onClick) {\n onClick(event);\n }\n };\n\n return (\n <ToolbarButton\n title={title || labels.assistantMessageToolbarCopyMessageLabel}\n onClick={handleClick}\n className={className}\n {...props}\n >\n {copied ? (\n <Check className=\"size-[18px]\" />\n ) : (\n <Copy className=\"size-[18px]\" />\n )}\n </ToolbarButton>\n );\n };\n\n export const ThumbsUpButton: React.FC<\n React.ButtonHTMLAttributes<HTMLButtonElement>\n > = ({ title, ...props }) => {\n const config = useCopilotChatConfiguration();\n const labels = config?.labels ?? CopilotChatDefaultLabels;\n return (\n <ToolbarButton\n title={title || labels.assistantMessageToolbarThumbsUpLabel}\n {...props}\n >\n <ThumbsUp className=\"size-[18px]\" />\n </ToolbarButton>\n );\n };\n\n export const ThumbsDownButton: React.FC<\n React.ButtonHTMLAttributes<HTMLButtonElement>\n > = ({ title, ...props }) => {\n const config = useCopilotChatConfiguration();\n const labels = config?.labels ?? CopilotChatDefaultLabels;\n return (\n <ToolbarButton\n title={title || labels.assistantMessageToolbarThumbsDownLabel}\n {...props}\n >\n <ThumbsDown className=\"size-[18px]\" />\n </ToolbarButton>\n );\n };\n\n export const ReadAloudButton: React.FC<\n React.ButtonHTMLAttributes<HTMLButtonElement>\n > = ({ title, ...props }) => {\n const config = useCopilotChatConfiguration();\n const labels = config?.labels ?? CopilotChatDefaultLabels;\n return (\n <ToolbarButton\n title={title || labels.assistantMessageToolbarReadAloudLabel}\n {...props}\n >\n <Volume2 className=\"size-[20px]\" />\n </ToolbarButton>\n );\n };\n\n export const RegenerateButton: React.FC<\n React.ButtonHTMLAttributes<HTMLButtonElement>\n > = ({ title, ...props }) => {\n const config = useCopilotChatConfiguration();\n const labels = config?.labels ?? CopilotChatDefaultLabels;\n return (\n <ToolbarButton\n title={title || labels.assistantMessageToolbarRegenerateLabel}\n {...props}\n >\n <RefreshCw className=\"size-[18px]\" />\n </ToolbarButton>\n );\n };\n}\n\nCopilotChatAssistantMessage.MarkdownRenderer.displayName =\n \"CopilotChatAssistantMessage.MarkdownRenderer\";\nCopilotChatAssistantMessage.Toolbar.displayName =\n \"CopilotChatAssistantMessage.Toolbar\";\nCopilotChatAssistantMessage.CopyButton.displayName =\n \"CopilotChatAssistantMessage.CopyButton\";\nCopilotChatAssistantMessage.ThumbsUpButton.displayName =\n \"CopilotChatAssistantMessage.ThumbsUpButton\";\nCopilotChatAssistantMessage.ThumbsDownButton.displayName =\n \"CopilotChatAssistantMessage.ThumbsDownButton\";\nCopilotChatAssistantMessage.ReadAloudButton.displayName =\n \"CopilotChatAssistantMessage.ReadAloudButton\";\nCopilotChatAssistantMessage.RegenerateButton.displayName =\n \"CopilotChatAssistantMessage.RegenerateButton\";\n\nexport default CopilotChatAssistantMessage;\n","import React, { useCallback, useEffect, useState } from \"react\";\nimport { ToolCall, ToolMessage } from \"@ag-ui/core\";\nimport { ToolCallStatus } from \"@copilotkitnext/core\";\nimport { useCopilotKit } from \"@/providers/CopilotKitProvider\";\nimport { useCopilotChatConfiguration } from \"@/providers/CopilotChatConfigurationProvider\";\nimport { DEFAULT_AGENT_ID } from \"@copilotkitnext/shared\";\nimport { partialJSONParse } from \"@copilotkitnext/shared\";\n\nexport interface UseRenderToolCallProps {\n toolCall: ToolCall;\n toolMessage?: ToolMessage;\n}\n\n/**\n * Hook that returns a function to render tool calls based on the render functions\n * defined in CopilotKitProvider.\n *\n * @returns A function that takes a tool call and optional tool message and returns the rendered component\n */\nexport function useRenderToolCall() {\n const { currentRenderToolCalls, copilotkit } = useCopilotKit();\n const config = useCopilotChatConfiguration();\n const agentId = config?.agentId ?? DEFAULT_AGENT_ID;\n const [executingToolCallIds, setExecutingToolCallIds] = useState<\n ReadonlySet<string>\n >(() => new Set());\n\n useEffect(() => {\n const unsubscribe = copilotkit.subscribe({\n onToolExecutionStart: ({ toolCallId }) => {\n setExecutingToolCallIds((prev) => {\n if (prev.has(toolCallId)) return prev;\n const next = new Set(prev);\n next.add(toolCallId);\n return next;\n });\n },\n onToolExecutionEnd: ({ toolCallId }) => {\n setExecutingToolCallIds((prev) => {\n if (!prev.has(toolCallId)) return prev;\n const next = new Set(prev);\n next.delete(toolCallId);\n return next;\n });\n },\n });\n return () => unsubscribe();\n }, [copilotkit]);\n\n const renderToolCall = useCallback(\n ({\n toolCall,\n toolMessage,\n }: UseRenderToolCallProps): React.ReactElement | null => {\n // Find the render config for this tool call by name\n // For rendering, we show all tool calls regardless of agentId\n // The agentId scoping only affects handler execution (in core)\n // Priority order:\n // 1. Exact match by name (prefer agent-specific if multiple exist)\n // 2. Wildcard (*) renderer\n const exactMatches = currentRenderToolCalls.filter(\n (rc) => rc.name === toolCall.function.name\n );\n\n // If multiple renderers with same name exist, prefer the one matching our agentId\n const renderConfig =\n exactMatches.find((rc) => rc.agentId === agentId) ||\n exactMatches.find((rc) => !rc.agentId) ||\n exactMatches[0] ||\n currentRenderToolCalls.find((rc) => rc.name === \"*\");\n\n if (!renderConfig) {\n return null;\n }\n\n const RenderComponent = renderConfig.render;\n\n // Parse the arguments if they're a string\n const args = partialJSONParse(toolCall.function.arguments);\n\n // Create props based on status with proper typing\n const toolName = toolCall.function.name;\n\n if (toolMessage) {\n // Complete status with result\n return (\n <RenderComponent\n key={toolCall.id}\n name={toolName}\n args={args}\n status={ToolCallStatus.Complete}\n result={toolMessage.content}\n />\n );\n } else if (executingToolCallIds.has(toolCall.id)) {\n // Tool is currently executing\n return (\n <RenderComponent\n key={toolCall.id}\n name={toolName}\n // args should be complete when executing; but pass whatever we have\n args={args}\n status={ToolCallStatus.Executing}\n result={undefined}\n />\n );\n } else {\n // In progress status - tool call exists but hasn't completed yet\n // This remains true even after agent stops running, until we get a result\n return (\n <RenderComponent\n key={toolCall.id}\n name={toolName}\n args={args}\n status={ToolCallStatus.InProgress}\n result={undefined}\n />\n );\n }\n },\n [currentRenderToolCalls, executingToolCallIds, agentId]\n );\n\n return renderToolCall;\n}\n","\"use client\";\n\nimport React, { createContext, useContext, ReactNode, useMemo, useEffect, useState, useReducer, useRef } from \"react\";\nimport { ReactToolCallRender } from \"../types/react-tool-call-render\";\nimport { ReactFrontendTool } from \"../types/frontend-tool\";\nimport { ReactHumanInTheLoop } from \"../types/human-in-the-loop\";\nimport { z } from \"zod\";\nimport { CopilotKitCore, CopilotKitCoreConfig, FrontendTool } from \"@copilotkitnext/core\";\nimport { AbstractAgent } from \"@ag-ui/client\";\n\n// Define the context value interface - idiomatic React naming\nexport interface CopilotKitContextValue {\n copilotkit: CopilotKitCore;\n renderToolCalls: ReactToolCallRender<any>[];\n currentRenderToolCalls: ReactToolCallRender<unknown>[];\n setCurrentRenderToolCalls: React.Dispatch<React.SetStateAction<ReactToolCallRender<unknown>[]>>;\n}\n\n// Create the CopilotKit context\nconst CopilotKitContext = createContext<CopilotKitContextValue>({\n copilotkit: null!,\n renderToolCalls: [],\n currentRenderToolCalls: [],\n setCurrentRenderToolCalls: () => {},\n});\n\n// Provider props interface\nexport interface CopilotKitProviderProps {\n children: ReactNode;\n runtimeUrl?: string;\n headers?: Record<string, string>;\n properties?: Record<string, unknown>;\n agents__unsafe_dev_only?: Record<string, AbstractAgent>;\n renderToolCalls?: ReactToolCallRender<any>[];\n frontendTools?: ReactFrontendTool[];\n humanInTheLoop?: ReactHumanInTheLoop[];\n}\n\n// Small helper to normalize array props to a stable reference and warn\nfunction useStableArrayProp<T>(\n prop: T[] | undefined,\n warningMessage?: string,\n isMeaningfulChange?: (initial: T[], next: T[]) => boolean,\n): T[] {\n const empty = useMemo<T[]>(() => [], []);\n const value = prop ?? empty;\n const initial = useRef(value);\n\n useEffect(() => {\n if (\n warningMessage &&\n value !== initial.current &&\n (isMeaningfulChange ? isMeaningfulChange(initial.current, value) : true)\n ) {\n console.error(warningMessage);\n }\n }, [value, warningMessage]);\n\n return value;\n}\n\n// Provider component\nexport const CopilotKitProvider: React.FC<CopilotKitProviderProps> = ({\n children,\n runtimeUrl,\n headers = {},\n properties = {},\n agents__unsafe_dev_only: agents = {},\n renderToolCalls,\n frontendTools,\n humanInTheLoop,\n}) => {\n // Normalize array props to stable references with clear dev warnings\n const renderToolCallsList = useStableArrayProp<ReactToolCallRender<any>>(\n renderToolCalls,\n \"renderToolCalls must be a stable array. If you want to dynamically add or remove tools, use `useFrontendTool` instead.\",\n (initial, next) => {\n // Only warn if the shape (names+agentId) changed. Allow identity changes\n // to support updated closures from parents (e.g., Storybook state).\n const key = (rc?: ReactToolCallRender<unknown>) => `${rc?.agentId ?? \"\"}:${rc?.name ?? \"\"}`;\n const setFrom = (arr: ReactToolCallRender<unknown>[]) => new Set(arr.map(key));\n const a = setFrom(initial);\n const b = setFrom(next);\n if (a.size !== b.size) return true;\n for (const k of a) if (!b.has(k)) return true;\n return false;\n },\n );\n const frontendToolsList = useStableArrayProp<ReactFrontendTool>(\n frontendTools,\n \"frontendTools must be a stable array. If you want to dynamically add or remove tools, use `useFrontendTool` instead.\",\n );\n const humanInTheLoopList = useStableArrayProp<ReactHumanInTheLoop>(\n humanInTheLoop,\n \"humanInTheLoop must be a stable array. If you want to dynamically add or remove human-in-the-loop tools, use `useHumanInTheLoop` instead.\",\n );\n\n const initialRenderToolCalls = useMemo(() => renderToolCallsList, []);\n const [currentRenderToolCalls, setCurrentRenderToolCalls] = useState<ReactToolCallRender<unknown>[]>([]);\n\n // Note: warnings for array identity changes are handled by useStableArrayProp\n\n // Process humanInTheLoop tools to create handlers and add render components\n const processedHumanInTheLoopTools = useMemo(() => {\n const processedTools: FrontendTool[] = [];\n const processedRenderToolCalls: ReactToolCallRender<unknown>[] = [];\n\n humanInTheLoopList.forEach((tool) => {\n // Create a promise-based handler for each human-in-the-loop tool\n const frontendTool: FrontendTool = {\n name: tool.name,\n description: tool.description,\n parameters: tool.parameters,\n followUp: tool.followUp,\n ...(tool.agentId && { agentId: tool.agentId }),\n handler: async () => {\n // This handler will be replaced by the hook when it runs\n // For provider-level tools, we create a basic handler that waits for user interaction\n return new Promise((resolve) => {\n // The actual implementation will be handled by the render component\n // This is a placeholder that the hook will override\n console.warn(`Human-in-the-loop tool '${tool.name}' called but no interactive handler is set up.`);\n resolve(undefined);\n });\n },\n };\n processedTools.push(frontendTool);\n\n // Add the render component to renderToolCalls\n if (tool.render) {\n processedRenderToolCalls.push({\n name: tool.name,\n args: tool.parameters!,\n render: tool.render,\n ...(tool.agentId && { agentId: tool.agentId }),\n } as ReactToolCallRender<unknown>);\n }\n });\n\n return { tools: processedTools, renderToolCalls: processedRenderToolCalls };\n }, [humanInTheLoopList]);\n\n // Combine all tools for CopilotKitCore\n const allTools = useMemo(() => {\n const tools: FrontendTool[] = [];\n\n // Add frontend tools\n tools.push(...frontendToolsList);\n\n // Add processed human-in-the-loop tools\n tools.push(...processedHumanInTheLoopTools.tools);\n\n return tools;\n }, [frontendToolsList, processedHumanInTheLoopTools]);\n\n // Combine all render tool calls\n const allRenderToolCalls = useMemo(() => {\n const combined: ReactToolCallRender<unknown>[] = [...renderToolCallsList];\n\n // Add render components from frontend tools\n frontendToolsList.forEach((tool) => {\n if (tool.render) {\n // For wildcard tools without parameters, default to z.any()\n const args = tool.parameters || (tool.name === \"*\" ? z.any() : undefined);\n if (args) {\n combined.push({\n name: tool.name,\n args: args,\n render: tool.render,\n } as ReactToolCallRender<unknown>);\n }\n }\n });\n\n // Add render components from human-in-the-loop tools\n combined.push(...processedHumanInTheLoopTools.renderToolCalls);\n\n return combined;\n }, [renderToolCallsList, frontendToolsList, processedHumanInTheLoopTools]);\n\n const copilotkit = useMemo(() => {\n const config: CopilotKitCoreConfig = {\n runtimeUrl,\n headers,\n properties,\n agents__unsafe_dev_only: agents,\n tools: allTools,\n };\n const copilotkit = new CopilotKitCore(config);\n\n return copilotkit;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [allTools]);\n\n // Merge computed render tool calls with any dynamically registered ones.\n // Computed entries (from props) take precedence for the same name/agentId.\n useEffect(() => {\n setCurrentRenderToolCalls((prev) => {\n // Build a map from computed entries\n const keyOf = (rc?: ReactToolCallRender<unknown>) => `${rc?.agentId ?? \"\"}:${rc?.name ?? \"\"}`;\n const computedMap = new Map<string, ReactToolCallRender<unknown>>();\n for (const rc of allRenderToolCalls) {\n computedMap.set(keyOf(rc), rc);\n }\n\n // Start with computed, then add any dynamic entries not present\n const merged: ReactToolCallRender<unknown>[] = [...computedMap.values()];\n for (const rc of prev) {\n const k = keyOf(rc);\n if (!computedMap.has(k)) merged.push(rc);\n }\n\n // If equal by shallow key comparison and reference order, avoid updates\n const sameLength = merged.length === prev.length;\n if (sameLength) {\n let same = true;\n for (let i = 0; i < merged.length; i++) {\n if (merged[i] !== prev[i]) {\n same = false;\n break;\n }\n }\n if (same) return prev;\n }\n return merged;\n });\n }, [allRenderToolCalls]);\n\n useEffect(() => {\n copilotkit.setRuntimeUrl(runtimeUrl);\n copilotkit.setHeaders(headers);\n copilotkit.setProperties(properties);\n copilotkit.setAgents__unsafe_dev_only(agents);\n }, [runtimeUrl, headers, properties, agents]);\n\n return (\n <CopilotKitContext.Provider\n value={{\n copilotkit,\n renderToolCalls: allRenderToolCalls,\n currentRenderToolCalls,\n setCurrentRenderToolCalls,\n }}\n >\n {children}\n </CopilotKitContext.Provider>\n );\n};\n\n// Hook to use the CopilotKit instance - returns the full context value\nexport const useCopilotKit = (): CopilotKitContextValue => {\n const context = useContext(CopilotKitContext);\n const [, forceUpdate] = useReducer((x) => x + 1, 0);\n\n if (!context) {\n throw new Error(\"useCopilotKit must be used within CopilotKitProvider\");\n }\n useEffect(() => {\n const unsubscribe = context.copilotkit.subscribe({\n onRuntimeConnectionStatusChanged: () => {\n forceUpdate();\n },\n });\n return () => {\n unsubscribe();\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return context;\n};\n","import { useEffect } from \"react\";\nimport { useCopilotKit } from \"../providers/CopilotKitProvider\";\nimport { ReactFrontendTool } from \"../types/frontend-tool\";\nimport { ReactToolCallRender } from \"../types/react-tool-call-render\";\n\nexport function useFrontendTool<\n T extends Record<string, unknown> = Record<string, unknown>,\n>(tool: ReactFrontendTool<T>) {\n const { copilotkit, setCurrentRenderToolCalls } = useCopilotKit();\n\n useEffect(() => {\n const name = tool.name;\n\n // Always register/override the tool for this name on mount\n if (copilotkit.getTool({ toolName: name, agentId: tool.agentId })) {\n console.warn(\n `Tool '${name}' already exists for agent '${tool.agentId || 'global'}'. Overriding with latest registration.`\n );\n copilotkit.removeTool(name, tool.agentId);\n }\n copilotkit.addTool(tool);\n\n // Register/override renderer by name and agentId\n if (tool.render) {\n setCurrentRenderToolCalls((prev) => {\n // Only replace renderers with the same name AND agentId\n const replaced = prev.filter((rc) => \n !(rc.name === name && rc.agentId === tool.agentId)\n );\n return [\n ...replaced,\n {\n name,\n args: tool.parameters,\n agentId: tool.agentId,\n render: tool.render,\n } as ReactToolCallRender<unknown>,\n ];\n });\n }\n\n return () => {\n copilotkit.removeTool(name, tool.agentId);\n // we are intentionally not removing the render here so that the tools can still render in the chat history\n };\n // Depend only on stable keys to avoid re-register loops due to object identity\n }, [tool.name, copilotkit, setCurrentRenderToolCalls]);\n}\n","import { ReactToolCallRender } from \"@/types/react-tool-call-render\";\nimport { useFrontendTool } from \"./use-frontend-tool\";\nimport { ReactFrontendTool } from \"@/types/frontend-tool\";\nimport { ReactHumanInTheLoop } from \"@/types/human-in-the-loop\";\nimport { useState, useCallback, useRef, useEffect } from \"react\";\nimport React from \"react\";\nimport { useCopilotKit } from \"@/providers/CopilotKitProvider\";\n\nexport function useHumanInTheLoop<T extends Record<string, unknown> = Record<string, unknown>>(\n tool: ReactHumanInTheLoop<T>\n) {\n const [status, setStatus] = useState<\"inProgress\" | \"executing\" | \"complete\">(\n \"inProgress\"\n );\n const statusRef = useRef(status);\n const resolvePromiseRef = useRef<((result: unknown) => void) | null>(null);\n const { setCurrentRenderToolCalls } = useCopilotKit();\n\n statusRef.current = status;\n\n const respond = useCallback(async (result: unknown) => {\n if (resolvePromiseRef.current) {\n resolvePromiseRef.current(result);\n setStatus(\"complete\");\n resolvePromiseRef.current = null;\n }\n }, []);\n\n const handler = useCallback(async () => {\n return new Promise((resolve) => {\n setStatus(\"executing\");\n resolvePromiseRef.current = resolve;\n });\n }, []);\n\n const RenderComponent: ReactToolCallRender<T>[\"render\"] = useCallback(\n (props) => {\n const ToolComponent = tool.render;\n const currentStatus = statusRef.current;\n\n // Enhance props based on current status\n if (currentStatus === \"inProgress\" && props.status === \"inProgress\") {\n const enhancedProps = {\n ...props,\n name: tool.name,\n description: tool.description || \"\",\n respond: undefined,\n };\n return React.createElement(ToolComponent, enhancedProps);\n } else if (currentStatus === \"executing\" && props.status === \"executing\") {\n const enhancedProps = {\n ...props,\n name: tool.name,\n description: tool.description || \"\",\n respond,\n };\n return React.createElement(ToolComponent, enhancedProps);\n } else if (currentStatus === \"complete\" && props.status === \"complete\") {\n const enhancedProps = {\n ...props,\n name: tool.name,\n description: tool.description || \"\",\n respond: undefined,\n };\n return React.createElement(ToolComponent, enhancedProps);\n }\n\n // Fallback - just render with original props\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return React.createElement(ToolComponent, props as any);\n },\n [tool.render, tool.name, tool.description, respond]\n );\n\n const frontendTool: ReactFrontendTool<T> = {\n ...tool,\n handler,\n render: RenderComponent,\n };\n\n useFrontendTool(frontendTool);\n\n useEffect(() => {\n return () => {\n setCurrentRenderToolCalls((prev) =>\n prev.filter(\n (rc) => rc.name !== tool.name || rc.agentId !== tool.agentId\n )\n );\n };\n }, [setCurrentRenderToolCalls, tool.name, tool.agentId]);\n}\n","import { useCopilotKit } from \"@/providers/CopilotKitProvider\";\nimport { useMemo, useEffect, useReducer } from \"react\";\nimport { DEFAULT_AGENT_ID } from \"@copilotkitnext/shared\";\nimport { AbstractAgent } from \"@ag-ui/client\";\n\nexport enum UseAgentUpdate {\n OnMessagesChanged = \"OnMessagesChanged\",\n OnStateChanged = \"OnStateChanged\",\n OnRunStatusChanged = \"OnRunStatusChanged\",\n}\n\nconst ALL_UPDATES: UseAgentUpdate[] = [\n UseAgentUpdate.OnMessagesChanged,\n UseAgentUpdate.OnStateChanged,\n UseAgentUpdate.OnRunStatusChanged,\n];\n\nexport interface UseAgentProps {\n agentId?: string;\n updates?: UseAgentUpdate[];\n}\n\nexport function useAgent({ agentId, updates }: UseAgentProps = {}) {\n agentId ??= DEFAULT_AGENT_ID;\n\n const { copilotkit } = useCopilotKit();\n const [, forceUpdate] = useReducer((x) => x + 1, 0);\n\n const updateFlags = useMemo(\n () => updates ?? ALL_UPDATES,\n [JSON.stringify(updates)]\n );\n\n const agent: AbstractAgent | undefined = useMemo(() => {\n return copilotkit.getAgent(agentId);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n agentId,\n copilotkit.agents,\n copilotkit.runtimeConnectionStatus,\n copilotkit,\n ]);\n\n useEffect(() => {\n if (!agent) {\n return;\n }\n\n if (updateFlags.length === 0) {\n return;\n }\n\n const handlers: Parameters<AbstractAgent[\"subscribe\"]>[0] = {};\n\n if (updateFlags.includes(UseAgentUpdate.OnMessagesChanged)) {\n handlers.onMessagesChanged = () => {\n forceUpdate();\n };\n }\n\n if (updateFlags.includes(UseAgentUpdate.OnStateChanged)) {\n handlers.onStateChanged = () => {\n forceUpdate();\n };\n }\n\n if (updateFlags.includes(UseAgentUpdate.OnRunStatusChanged)) {\n handlers.onRunInitialized = () => {\n forceUpdate();\n };\n handlers.onRunFinalized = () => {\n forceUpdate();\n };\n handlers.onRunFailed = () => {\n forceUpdate();\n };\n }\n\n const subscription = agent.subscribe(handlers);\n return () => subscription.unsubscribe();\n }, [agent, forceUpdate, JSON.stringify(updateFlags)]);\n\n return {\n agent,\n };\n}\n","import { useCopilotKit } from \"../providers/CopilotKitProvider\";\nimport { Context } from \"@ag-ui/client\";\nimport { useEffect } from \"react\";\n\nexport function useAgentContext(context: Context) {\n const { description, value } = context;\n const { copilotkit } = useCopilotKit();\n\n useEffect(() => {\n if (!copilotkit) return;\n\n const id = copilotkit.addContext(context);\n return () => {\n copilotkit.removeContext(id);\n };\n }, [description, value, copilotkit]);\n}\n","import { useCallback, useEffect, useMemo, useState } from \"react\";\nimport { Suggestion } from \"@copilotkitnext/core\";\nimport { useCopilotKit } from \"@/providers/CopilotKitProvider\";\nimport { useCopilotChatConfiguration } from \"@/providers/CopilotChatConfigurationProvider\";\nimport { DEFAULT_AGENT_ID } from \"@copilotkitnext/shared\";\n\nexport interface UseSuggestionsOptions {\n agentId?: string;\n}\n\nexport interface UseSuggestionsResult {\n suggestions: Suggestion[];\n reloadSuggestions: () => void;\n clearSuggestions: () => void;\n isLoading: boolean;\n}\n\nexport function useSuggestions({ agentId }: UseSuggestionsOptions = {}): UseSuggestionsResult {\n const { copilotkit } = useCopilotKit();\n const config = useCopilotChatConfiguration();\n const resolvedAgentId = useMemo(() => agentId ?? config?.agentId ?? DEFAULT_AGENT_ID, [agentId, config?.agentId]);\n\n const [suggestions, setSuggestions] = useState<Suggestion[]>(() => {\n const result = copilotkit.getSuggestions(resolvedAgentId);\n return result.suggestions;\n });\n const [isLoading, setIsLoading] = useState(() => {\n const result = copilotkit.getSuggestions(resolvedAgentId);\n return result.isLoading;\n });\n\n useEffect(() => {\n const result = copilotkit.getSuggestions(resolvedAgentId);\n setSuggestions(result.suggestions);\n setIsLoading(result.isLoading);\n }, [copilotkit, resolvedAgentId]);\n\n useEffect(() => {\n const unsubscribe = copilotkit.subscribe({\n onSuggestionsChanged: ({ agentId: changedAgentId, suggestions }) => {\n if (changedAgentId !== resolvedAgentId) {\n return;\n }\n setSuggestions(suggestions);\n },\n onSuggestionsStartedLoading: ({ agentId: changedAgentId }) => {\n if (changedAgentId !== resolvedAgentId) {\n return;\n }\n setIsLoading(true);\n },\n onSuggestionsFinishedLoading: ({ agentId: changedAgentId }) => {\n if (changedAgentId !== resolvedAgentId) {\n return;\n }\n setIsLoading(false);\n },\n onSuggestionsConfigChanged: () => {\n const result = copilotkit.getSuggestions(resolvedAgentId);\n setSuggestions(result.suggestions);\n setIsLoading(result.isLoading);\n },\n });\n\n return () => {\n unsubscribe();\n };\n }, [copilotkit, resolvedAgentId]);\n\n const reloadSuggestions = useCallback(() => {\n copilotkit.reloadSuggestions(resolvedAgentId);\n // Loading state is handled by onSuggestionsStartedLoading event\n }, [copilotkit, resolvedAgentId]);\n\n const clearSuggestions = useCallback(() => {\n copilotkit.clearSuggestions(resolvedAgentId);\n // State updates are handled by onSuggestionsChanged event\n }, [copilotkit, resolvedAgentId]);\n\n return {\n suggestions,\n reloadSuggestions,\n clearSuggestions,\n isLoading,\n };\n}\n","import { useCallback, useEffect, useMemo, useRef } from \"react\";\nimport { useCopilotKit } from \"@/providers/CopilotKitProvider\";\nimport { useCopilotChatConfiguration } from \"@/providers/CopilotChatConfigurationProvider\";\nimport { DEFAULT_AGENT_ID } from \"@copilotkitnext/shared\";\nimport {\n DynamicSuggestionsConfig,\n StaticSuggestionsConfig,\n SuggestionsConfig,\n Suggestion,\n} from \"@copilotkitnext/core\";\n\ntype StaticSuggestionInput = Omit<Suggestion, \"isLoading\"> & Partial<Pick<Suggestion, \"isLoading\">>;\n\ntype StaticSuggestionsConfigInput = Omit<StaticSuggestionsConfig, \"suggestions\"> & {\n suggestions: StaticSuggestionInput[];\n};\n\ntype SuggestionsConfigInput = DynamicSuggestionsConfig | StaticSuggestionsConfigInput;\n\nconst EMPTY_DEPS: ReadonlyArray<unknown> = [];\n\nexport interface UseConfigureSuggestionsOptions {\n deps?: ReadonlyArray<unknown>;\n}\n\nexport function useConfigureSuggestions(\n config: SuggestionsConfigInput | null | undefined,\n options?: UseConfigureSuggestionsOptions,\n): void {\n const { copilotkit } = useCopilotKit();\n const chatConfig = useCopilotChatConfiguration();\n const extraDeps = options?.deps ?? EMPTY_DEPS;\n\n const resolvedConsumerAgentId = useMemo(() => chatConfig?.agentId ?? DEFAULT_AGENT_ID, [chatConfig?.agentId]);\n\n const rawConsumerAgentId = useMemo(() => (config ? (config as SuggestionsConfigInput).consumerAgentId : undefined), [config]);\n\n const normalizationCacheRef = useRef<{ serialized: string | null; config: SuggestionsConfig | null }>({\n serialized: null,\n config: null,\n });\n\n const { normalizedConfig, serializedConfig } = useMemo(() => {\n if (!config) {\n normalizationCacheRef.current = { serialized: null, config: null };\n return { normalizedConfig: null, serializedConfig: null };\n }\n\n if (config.available === \"disabled\") {\n normalizationCacheRef.current = { serialized: null, config: null };\n return { normalizedConfig: null, serializedConfig: null };\n }\n\n let built: SuggestionsConfig;\n if (isDynamicConfig(config)) {\n built = {\n ...config,\n } satisfies DynamicSuggestionsConfig;\n } else {\n const normalizedSuggestions = normalizeStaticSuggestions(config.suggestions);\n const baseConfig: StaticSuggestionsConfig = {\n ...config,\n suggestions: normalizedSuggestions,\n };\n built = baseConfig;\n }\n\n const serialized = JSON.stringify(built);\n const cache = normalizationCacheRef.current;\n if (cache.serialized === serialized && cache.config) {\n return { normalizedConfig: cache.config, serializedConfig: serialized };\n }\n\n normalizationCacheRef.current = { serialized, config: built };\n return { normalizedConfig: built, serializedConfig: serialized };\n }, [config, resolvedConsumerAgentId, ...extraDeps]);\n const latestConfigRef = useRef<SuggestionsConfig | null>(null);\n latestConfigRef.current = normalizedConfig;\n const previousSerializedConfigRef = useRef<string | null>(null);\n\n const targetAgentId = useMemo(() => {\n if (!normalizedConfig) {\n return resolvedConsumerAgentId;\n }\n const consumer = (normalizedConfig as StaticSuggestionsConfig | DynamicSuggestionsConfig).consumerAgentId;\n if (!consumer || consumer === \"*\") {\n return resolvedConsumerAgentId;\n }\n return consumer;\n }, [normalizedConfig, resolvedConsumerAgentId]);\n\n const isGlobalConfig = rawConsumerAgentId === undefined || rawConsumerAgentId === \"*\";\n\n const requestReload = useCallback(() => {\n if (!normalizedConfig) {\n return;\n }\n\n if (isGlobalConfig) {\n const agents = Object.values(copilotkit.agents ?? {});\n for (const entry of agents) {\n const agentId = entry.agentId;\n if (!agentId) {\n continue;\n }\n if (!entry.isRunning) {\n copilotkit.reloadSuggestions(agentId);\n }\n }\n return;\n }\n\n if (!targetAgentId) {\n return;\n }\n\n copilotkit.reloadSuggestions(targetAgentId);\n }, [copilotkit, isGlobalConfig, normalizedConfig, targetAgentId]);\n\n useEffect(() => {\n if (!serializedConfig || !latestConfigRef.current) {\n return;\n }\n\n const id = copilotkit.addSuggestionsConfig(latestConfigRef.current);\n\n requestReload();\n\n return () => {\n copilotkit.removeSuggestionsConfig(id);\n };\n }, [copilotkit, serializedConfig, requestReload]);\n\n useEffect(() => {\n if (!normalizedConfig) {\n previousSerializedConfigRef.current = null;\n return;\n }\n if (serializedConfig && previousSerializedConfigRef.current === serializedConfig) {\n return;\n }\n if (serializedConfig) {\n previousSerializedConfigRef.current = serializedConfig;\n }\n requestReload();\n }, [normalizedConfig, requestReload, serializedConfig]);\n\n useEffect(() => {\n if (!normalizedConfig || extraDeps.length === 0) {\n return;\n }\n requestReload();\n }, [extraDeps.length, normalizedConfig, requestReload, ...extraDeps]);\n\n}\n\nfunction isDynamicConfig(config: SuggestionsConfigInput): config is DynamicSuggestionsConfig {\n return \"instructions\" in config;\n}\n\nfunction normalizeStaticSuggestions(suggestions: StaticSuggestionInput[]): Suggestion[] {\n return suggestions.map((suggestion) => ({\n ...suggestion,\n isLoading: suggestion.isLoading ?? false,\n }));\n}\n","import { useRenderToolCall } from \"@/hooks\";\nimport { AssistantMessage, Message, ToolMessage } from \"@ag-ui/core\";\nimport React from \"react\";\n\nexport type CopilotChatToolCallsViewProps = {\n message: AssistantMessage;\n messages?: Message[];\n};\n\nexport function CopilotChatToolCallsView({\n message,\n messages = [],\n}: CopilotChatToolCallsViewProps) {\n const renderToolCall = useRenderToolCall();\n\n if (!message.toolCalls || message.toolCalls.length === 0) {\n return null;\n }\n\n return (\n <>\n {message.toolCalls.map((toolCall) => {\n const toolMessage = messages.find(\n (m) => m.role === \"tool\" && m.toolCallId === toolCall.id\n ) as ToolMessage | undefined;\n\n return (\n <React.Fragment key={toolCall.id}>\n {renderToolCall({\n toolCall,\n toolMessage,\n })}\n </React.Fragment>\n );\n })}\n </>\n );\n}\n\nexport default CopilotChatToolCallsView;\n","import { useState } from \"react\";\nimport { Copy, Check, Edit, ChevronLeft, ChevronRight } from \"lucide-react\";\nimport {\n useCopilotChatConfiguration,\n CopilotChatDefaultLabels,\n} from \"@/providers/CopilotChatConfigurationProvider\";\nimport { twMerge } from \"tailwind-merge\";\nimport { Button } from \"@/components/ui/button\";\nimport { UserMessage } from \"@ag-ui/core\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from \"@/components/ui/tooltip\";\nimport { renderSlot, WithSlots } from \"@/lib/slots\";\n\nexport interface CopilotChatUserMessageOnEditMessageProps {\n message: UserMessage;\n}\n\nexport interface CopilotChatUserMessageOnSwitchToBranchProps {\n message: UserMessage;\n branchIndex: number;\n numberOfBranches: number;\n}\n\nexport type CopilotChatUserMessageProps = WithSlots<\n {\n messageRenderer: typeof CopilotChatUserMessage.MessageRenderer;\n toolbar: typeof CopilotChatUserMessage.Toolbar;\n copyButton: typeof CopilotChatUserMessage.CopyButton;\n editButton: typeof CopilotChatUserMessage.EditButton;\n branchNavigation: typeof CopilotChatUserMessage.BranchNavigation;\n },\n {\n onEditMessage?: (props: CopilotChatUserMessageOnEditMessageProps) => void;\n onSwitchToBranch?: (\n props: CopilotChatUserMessageOnSwitchToBranchProps\n ) => void;\n message: UserMessage;\n branchIndex?: number;\n numberOfBranches?: number;\n additionalToolbarItems?: React.ReactNode;\n } & React.HTMLAttributes<HTMLDivElement>\n>;\n\nexport function CopilotChatUserMessage({\n message,\n onEditMessage,\n branchIndex,\n numberOfBranches,\n onSwitchToBranch,\n additionalToolbarItems,\n messageRenderer,\n toolbar,\n copyButton,\n editButton,\n branchNavigation,\n children,\n className,\n ...props\n}: CopilotChatUserMessageProps) {\n const BoundMessageRenderer = renderSlot(\n messageRenderer,\n CopilotChatUserMessage.MessageRenderer,\n {\n content: message.content || \"\",\n }\n );\n\n const BoundCopyButton = renderSlot(\n copyButton,\n CopilotChatUserMessage.CopyButton,\n {\n onClick: async () => {\n if (message.content) {\n try {\n await navigator.clipboard.writeText(message.content);\n } catch (err) {\n console.error(\"Failed to copy message:\", err);\n }\n }\n },\n }\n );\n\n const BoundEditButton = renderSlot(\n editButton,\n CopilotChatUserMessage.EditButton,\n {\n onClick: () => onEditMessage?.({ message }),\n }\n );\n\n const BoundBranchNavigation = renderSlot(\n branchNavigation,\n CopilotChatUserMessage.BranchNavigation,\n {\n currentBranch: branchIndex,\n numberOfBranches,\n onSwitchToBranch,\n message,\n }\n );\n\n const showBranchNavigation =\n numberOfBranches && numberOfBranches > 1 && onSwitchToBranch;\n\n const BoundToolbar = renderSlot(toolbar, CopilotChatUserMessage.Toolbar, {\n children: (\n <div className=\"flex items-center gap-1 justify-end\">\n {additionalToolbarItems}\n {BoundCopyButton}\n {onEditMessage && BoundEditButton}\n {showBranchNavigation && BoundBranchNavigation}\n </div>\n ),\n });\n\n if (children) {\n return (\n <>\n {children({\n messageRenderer: BoundMessageRenderer,\n toolbar: BoundToolbar,\n copyButton: BoundCopyButton,\n editButton: BoundEditButton,\n branchNavigation: BoundBranchNavigation,\n message,\n branchIndex,\n numberOfBranches,\n additionalToolbarItems,\n })}\n </>\n );\n }\n\n return (\n <div\n className={twMerge(\"flex flex-col items-end group pt-10\", className)}\n data-message-id={message.id}\n {...props}\n >\n {BoundMessageRenderer}\n {BoundToolbar}\n </div>\n );\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace CopilotChatUserMessage {\n export const Container: React.FC<\n React.PropsWithChildren<React.HTMLAttributes<HTMLDivElement>>\n > = ({ children, className, ...props }) => (\n <div\n className={twMerge(\"flex flex-col items-end group\", className)}\n {...props}\n >\n {children}\n </div>\n );\n\n export const MessageRenderer: React.FC<{\n content: string;\n className?: string;\n }> = ({ content, className }) => (\n <div\n className={twMerge(\n \"prose dark:prose-invert bg-muted relative max-w-[80%] rounded-[18px] px-4 py-1.5 data-[multiline]:py-3 inline-block whitespace-pre-wrap\",\n className\n )}\n >\n {content}\n </div>\n );\n\n export const Toolbar: React.FC<React.HTMLAttributes<HTMLDivElement>> = ({\n className,\n ...props\n }) => (\n <div\n className={twMerge(\n \"w-full bg-transparent flex items-center justify-end -mr-[5px] mt-[4px] invisible group-hover:visible\",\n className\n )}\n {...props}\n />\n );\n\n export const ToolbarButton: React.FC<\n React.ButtonHTMLAttributes<HTMLButtonElement> & {\n title: string;\n children: React.ReactNode;\n }\n > = ({ title, children, className, ...props }) => {\n return (\n <Tooltip>\n <TooltipTrigger asChild>\n <Button\n type=\"button\"\n variant=\"assistantMessageToolbarButton\"\n aria-label={title}\n className={twMerge(className)}\n {...props}\n >\n {children}\n </Button>\n </TooltipTrigger>\n <TooltipContent side=\"bottom\">\n <p>{title}</p>\n </TooltipContent>\n </Tooltip>\n );\n };\n\n export const CopyButton: React.FC<\n React.ButtonHTMLAttributes<HTMLButtonElement> & { copied?: boolean }\n > = ({ className, title, onClick, ...props }) => {\n const config = useCopilotChatConfiguration();\n const labels = config?.labels ?? CopilotChatDefaultLabels;\n const [copied, setCopied] = useState(false);\n\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n setCopied(true);\n setTimeout(() => setCopied(false), 2000);\n\n if (onClick) {\n onClick(event);\n }\n };\n\n return (\n <ToolbarButton\n title={title || labels.userMessageToolbarCopyMessageLabel}\n onClick={handleClick}\n className={className}\n {...props}\n >\n {copied ? (\n <Check className=\"size-[18px]\" />\n ) : (\n <Copy className=\"size-[18px]\" />\n )}\n </ToolbarButton>\n );\n };\n\n export const EditButton: React.FC<\n React.ButtonHTMLAttributes<HTMLButtonElement>\n > = ({ className, title, ...props }) => {\n const config = useCopilotChatConfiguration();\n const labels = config?.labels ?? CopilotChatDefaultLabels;\n return (\n <ToolbarButton\n title={title || labels.userMessageToolbarEditMessageLabel}\n className={className}\n {...props}\n >\n <Edit className=\"size-[18px]\" />\n </ToolbarButton>\n );\n };\n\n export const BranchNavigation: React.FC<\n React.HTMLAttributes<HTMLDivElement> & {\n currentBranch?: number;\n numberOfBranches?: number;\n onSwitchToBranch?: (\n props: CopilotChatUserMessageOnSwitchToBranchProps\n ) => void;\n message: UserMessage;\n }\n > = ({\n className,\n currentBranch = 0,\n numberOfBranches = 1,\n onSwitchToBranch,\n message,\n ...props\n }) => {\n if (!numberOfBranches || numberOfBranches <= 1 || !onSwitchToBranch) {\n return null;\n }\n\n const canGoPrev = currentBranch > 0;\n const canGoNext = currentBranch < numberOfBranches - 1;\n\n return (\n <div className={twMerge(\"flex items-center gap-1\", className)} {...props}>\n <Button\n type=\"button\"\n variant=\"assistantMessageToolbarButton\"\n onClick={() =>\n onSwitchToBranch?.({\n branchIndex: currentBranch - 1,\n numberOfBranches,\n message,\n })\n }\n disabled={!canGoPrev}\n className=\"h-6 w-6 p-0\"\n >\n <ChevronLeft className=\"size-[20px]\" />\n </Button>\n <span className=\"text-sm text-muted-foreground px-0 font-medium\">\n {currentBranch + 1}/{numberOfBranches}\n </span>\n <Button\n type=\"button\"\n variant=\"assistantMessageToolbarButton\"\n onClick={() =>\n onSwitchToBranch?.({\n branchIndex: currentBranch + 1,\n numberOfBranches,\n message,\n })\n }\n disabled={!canGoNext}\n className=\"h-6 w-6 p-0\"\n >\n <ChevronRight className=\"size-[20px]\" />\n </Button>\n </div>\n );\n };\n}\n\nCopilotChatUserMessage.Container.displayName =\n \"CopilotChatUserMessage.Container\";\nCopilotChatUserMessage.MessageRenderer.displayName =\n \"CopilotChatUserMessage.MessageRenderer\";\nCopilotChatUserMessage.Toolbar.displayName = \"CopilotChatUserMessage.Toolbar\";\nCopilotChatUserMessage.ToolbarButton.displayName =\n \"CopilotChatUserMessage.ToolbarButton\";\nCopilotChatUserMessage.CopyButton.displayName =\n \"CopilotChatUserMessage.CopyButton\";\nCopilotChatUserMessage.EditButton.displayName =\n \"CopilotChatUserMessage.EditButton\";\nCopilotChatUserMessage.BranchNavigation.displayName =\n \"CopilotChatUserMessage.BranchNavigation\";\n\nexport default CopilotChatUserMessage;\n","import React from \"react\";\nimport { Loader2 } from \"lucide-react\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface CopilotChatSuggestionPillProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /** Optional icon to render on the left side when not loading. */\n icon?: React.ReactNode;\n /** Whether the pill should display a loading spinner. */\n isLoading?: boolean;\n}\n\nconst baseClasses =\n \"group inline-flex h-8 items-center gap-1.5 rounded-full border border-border/60 bg-background px-3 text-xs leading-none text-foreground transition-colors cursor-pointer hover:bg-accent/60 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:text-muted-foreground disabled:hover:bg-background disabled:hover:text-muted-foreground pointer-events-auto\";\n\nconst labelClasses = \"whitespace-nowrap font-medium leading-none\";\n\nexport const CopilotChatSuggestionPill = React.forwardRef<\n HTMLButtonElement,\n CopilotChatSuggestionPillProps\n>(function CopilotChatSuggestionPill(\n { className, children, icon, isLoading, type, ...props },\n ref\n) {\n const showIcon = !isLoading && icon;\n\n return (\n <button\n ref={ref}\n data-slot=\"suggestion-pill\"\n className={cn(baseClasses, className)}\n type={type ?? \"button\"}\n aria-busy={isLoading || undefined}\n disabled={isLoading || props.disabled}\n {...props}\n >\n {isLoading ? (\n <span className=\"flex h-4 w-4 items-center justify-center text-muted-foreground\">\n <Loader2 className=\"h-4 w-4 animate-spin\" aria-hidden=\"true\" />\n </span>\n ) : (\n showIcon && (\n <span className=\"flex h-4 w-4 items-center justify-center text-muted-foreground\">{icon}</span>\n )\n )}\n <span className={labelClasses}>{children}</span>\n </button>\n );\n});\n\nCopilotChatSuggestionPill.displayName = \"CopilotChatSuggestionPill\";\n\nexport default CopilotChatSuggestionPill;\n","import React from \"react\";\nimport { Suggestion } from \"@copilotkitnext/core\";\nimport { renderSlot, WithSlots } from \"@/lib/slots\";\nimport { cn } from \"@/lib/utils\";\nimport CopilotChatSuggestionPill, {\n CopilotChatSuggestionPillProps,\n} from \"./CopilotChatSuggestionPill\";\n\nconst DefaultContainer = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(function DefaultContainer({ className, ...props }, ref) {\n return (\n <div\n ref={ref}\n className={cn(\n \"flex flex-wrap items-center gap-2 px-4 sm:px-0 pointer-events-none\",\n className,\n )}\n {...props}\n />\n );\n});\n\nexport type CopilotChatSuggestionViewProps = WithSlots<\n {\n container: typeof DefaultContainer;\n suggestion: typeof CopilotChatSuggestionPill;\n },\n {\n suggestions: Suggestion[];\n onSelectSuggestion?: (suggestion: Suggestion, index: number) => void;\n loadingIndexes?: ReadonlyArray<number>;\n } & React.HTMLAttributes<HTMLDivElement>\n>;\n\nexport const CopilotChatSuggestionView = React.forwardRef<\n HTMLDivElement,\n CopilotChatSuggestionViewProps\n>(function CopilotChatSuggestionView(\n {\n suggestions,\n onSelectSuggestion,\n loadingIndexes,\n container,\n suggestion: suggestionSlot,\n className,\n children,\n ...restProps\n },\n ref,\n) {\n const loadingSet = React.useMemo(() => {\n if (!loadingIndexes || loadingIndexes.length === 0) {\n return new Set<number>();\n }\n return new Set(loadingIndexes);\n }, [loadingIndexes]);\n\n const ContainerElement = renderSlot(container, DefaultContainer, {\n ref,\n className,\n ...restProps,\n });\n\n const suggestionElements = suggestions.map((suggestion, index) => {\n const isLoading = loadingSet.has(index) || suggestion.isLoading === true;\n const pill = renderSlot<\n typeof CopilotChatSuggestionPill,\n CopilotChatSuggestionPillProps\n >(suggestionSlot, CopilotChatSuggestionPill, {\n children: suggestion.title,\n isLoading,\n type: \"button\",\n onClick: () => onSelectSuggestion?.(suggestion, index),\n });\n\n return React.cloneElement(pill, {\n key: `${suggestion.title}-${index}`,\n });\n });\n\n const boundContainer = React.cloneElement(\n ContainerElement,\n undefined,\n suggestionElements,\n );\n\n if (typeof children === \"function\") {\n const sampleSuggestion = renderSlot<\n typeof CopilotChatSuggestionPill,\n CopilotChatSuggestionPillProps\n >(suggestionSlot, CopilotChatSuggestionPill, {\n children: suggestions[0]?.title ?? \"\",\n isLoading:\n suggestions.length > 0 ? loadingSet.has(0) || suggestions[0]?.isLoading === true : false,\n type: \"button\",\n });\n\n return (\n <>\n {children({\n container: boundContainer,\n suggestion: sampleSuggestion,\n suggestions,\n onSelectSuggestion,\n loadingIndexes,\n className,\n ...restProps,\n })}\n </>\n );\n }\n\n if (children) {\n return (\n <>\n {boundContainer}\n {children}\n </>\n );\n }\n\n return boundContainer;\n});\n\nCopilotChatSuggestionView.displayName = \"CopilotChatSuggestionView\";\n\nexport default CopilotChatSuggestionView;\n","import { WithSlots, renderSlot } from \"@/lib/slots\";\nimport CopilotChatAssistantMessage from \"./CopilotChatAssistantMessage\";\nimport CopilotChatUserMessage from \"./CopilotChatUserMessage\";\nimport { Message } from \"@ag-ui/core\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport type CopilotChatMessageViewProps = Omit<\n WithSlots<\n {\n assistantMessage: typeof CopilotChatAssistantMessage;\n userMessage: typeof CopilotChatUserMessage;\n cursor: typeof CopilotChatMessageView.Cursor;\n },\n {\n isRunning?: boolean;\n messages?: Message[];\n } & React.HTMLAttributes<HTMLDivElement>\n >,\n \"children\"\n> & {\n children?: (props: {\n isRunning: boolean;\n messages: Message[];\n messageElements: React.ReactElement[];\n }) => React.ReactElement;\n};\n\nexport function CopilotChatMessageView({\n messages = [],\n assistantMessage,\n userMessage,\n cursor,\n isRunning = false,\n children,\n className,\n ...props\n}: CopilotChatMessageViewProps) {\n const messageElements: React.ReactElement[] = messages\n .map((message) => {\n if (message.role === \"assistant\") {\n return renderSlot(assistantMessage, CopilotChatAssistantMessage, {\n key: message.id,\n message,\n messages,\n isRunning,\n });\n } else if (message.role === \"user\") {\n return renderSlot(userMessage, CopilotChatUserMessage, {\n key: message.id,\n message,\n });\n }\n\n return;\n })\n .filter(Boolean) as React.ReactElement[];\n\n if (children) {\n return children({ messageElements, messages, isRunning });\n }\n\n return (\n <div className={twMerge(\"flex flex-col\", className)} {...props}>\n {messageElements}\n {isRunning && renderSlot(cursor, CopilotChatMessageView.Cursor, {})}\n </div>\n );\n}\n\nCopilotChatMessageView.Cursor = function Cursor({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) {\n return (\n <div\n className={twMerge(\n \"w-[11px] h-[11px] rounded-full bg-foreground animate-pulse-cursor ml-1\",\n className\n )}\n {...props}\n />\n );\n};\n\nexport default CopilotChatMessageView;\n","import React, { useRef, useState, useEffect } from \"react\";\nimport { WithSlots, renderSlot } from \"@/lib/slots\";\nimport CopilotChatMessageView from \"./CopilotChatMessageView\";\nimport CopilotChatInput, { CopilotChatInputProps } from \"./CopilotChatInput\";\nimport CopilotChatSuggestionView, { CopilotChatSuggestionViewProps } from \"./CopilotChatSuggestionView\";\nimport { Suggestion } from \"@copilotkitnext/core\";\nimport { Message } from \"@ag-ui/core\";\nimport { twMerge } from \"tailwind-merge\";\nimport { StickToBottom, useStickToBottom, useStickToBottomContext } from \"use-stick-to-bottom\";\nimport { ChevronDown } from \"lucide-react\";\nimport { Button } from \"@/components/ui/button\";\nimport { cn } from \"@/lib/utils\";\nimport { useCopilotChatConfiguration, CopilotChatDefaultLabels } from \"@/providers/CopilotChatConfigurationProvider\";\n\nexport type CopilotChatViewProps = WithSlots<\n {\n messageView: typeof CopilotChatMessageView;\n scrollView: React.FC<React.HTMLAttributes<HTMLDivElement>>;\n scrollToBottomButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement>>;\n input: typeof CopilotChatInput;\n inputContainer: React.FC<React.HTMLAttributes<HTMLDivElement> & { children: React.ReactNode }>;\n feather: React.FC<React.HTMLAttributes<HTMLDivElement>>;\n disclaimer: React.FC<React.HTMLAttributes<HTMLDivElement>>;\n suggestionView: typeof CopilotChatSuggestionView;\n },\n {\n messages?: Message[];\n autoScroll?: boolean;\n inputProps?: Partial<Omit<CopilotChatInputProps, \"children\">>;\n isRunning?: boolean;\n suggestions?: Suggestion[];\n suggestionLoadingIndexes?: ReadonlyArray<number>;\n onSelectSuggestion?: (suggestion: Suggestion, index: number) => void;\n } & React.HTMLAttributes<HTMLDivElement>\n>;\n\nexport function CopilotChatView({\n messageView,\n input,\n scrollView,\n scrollToBottomButton,\n feather,\n inputContainer,\n disclaimer,\n suggestionView,\n messages = [],\n autoScroll = true,\n inputProps,\n isRunning = false,\n suggestions,\n suggestionLoadingIndexes,\n onSelectSuggestion,\n children,\n className,\n ...props\n}: CopilotChatViewProps) {\n const inputContainerRef = useRef<HTMLDivElement>(null);\n const [inputContainerHeight, setInputContainerHeight] = useState(0);\n const [isResizing, setIsResizing] = useState(false);\n const resizeTimeoutRef = useRef<NodeJS.Timeout | null>(null);\n\n // Track input container height changes\n useEffect(() => {\n const element = inputContainerRef.current;\n if (!element) return;\n\n const resizeObserver = new ResizeObserver((entries) => {\n for (const entry of entries) {\n const newHeight = entry.contentRect.height;\n\n // Update height and set resizing state\n setInputContainerHeight((prevHeight) => {\n if (newHeight !== prevHeight) {\n setIsResizing(true);\n\n // Clear existing timeout\n if (resizeTimeoutRef.current) {\n clearTimeout(resizeTimeoutRef.current);\n }\n\n // Set isResizing to false after a short delay\n resizeTimeoutRef.current = setTimeout(() => {\n setIsResizing(false);\n }, 250);\n\n return newHeight;\n }\n return prevHeight;\n });\n }\n });\n\n resizeObserver.observe(element);\n\n // Set initial height\n setInputContainerHeight(element.offsetHeight);\n\n return () => {\n resizeObserver.disconnect();\n if (resizeTimeoutRef.current) {\n clearTimeout(resizeTimeoutRef.current);\n }\n };\n }, []);\n\n const BoundMessageView = renderSlot(messageView, CopilotChatMessageView, {\n messages,\n isRunning,\n });\n\n const BoundInput = renderSlot(input, CopilotChatInput, (inputProps ?? {}) as CopilotChatInputProps);\n const hasSuggestions = Array.isArray(suggestions) && suggestions.length > 0;\n const BoundSuggestionView = hasSuggestions\n ? renderSlot<typeof CopilotChatSuggestionView, CopilotChatSuggestionViewProps>(\n suggestionView,\n CopilotChatSuggestionView,\n {\n suggestions,\n loadingIndexes: suggestionLoadingIndexes,\n onSelectSuggestion,\n className: \"mb-3 lg:ml-4 lg:mr-4 ml-0 mr-0\",\n },\n )\n : null;\n const BoundFeather = renderSlot(feather, CopilotChatView.Feather, {});\n const BoundScrollView = renderSlot(scrollView, CopilotChatView.ScrollView, {\n autoScroll,\n scrollToBottomButton,\n inputContainerHeight,\n isResizing,\n children: (\n <div style={{ paddingBottom: `${inputContainerHeight + (hasSuggestions ? 4 : 32)}px` }}>\n <div className=\"max-w-3xl mx-auto\">\n {BoundMessageView}\n {hasSuggestions ? <div className=\"px-4 sm:px-0 mt-4\">{BoundSuggestionView}</div> : null}\n </div>\n </div>\n ),\n });\n\n const BoundScrollToBottomButton = renderSlot(scrollToBottomButton, CopilotChatView.ScrollToBottomButton, {});\n\n const BoundDisclaimer = renderSlot(disclaimer, CopilotChatView.Disclaimer, {});\n\n const BoundInputContainer = renderSlot(inputContainer, CopilotChatView.InputContainer, {\n ref: inputContainerRef,\n children: (\n <>\n <div className=\"max-w-3xl mx-auto py-0 px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8 pointer-events-auto\">\n {BoundInput}\n </div>\n {BoundDisclaimer}\n </>\n ),\n });\n\n if (children) {\n return children({\n messageView: BoundMessageView,\n input: BoundInput,\n scrollView: BoundScrollView,\n scrollToBottomButton: BoundScrollToBottomButton,\n feather: BoundFeather,\n inputContainer: BoundInputContainer,\n disclaimer: BoundDisclaimer,\n suggestionView: BoundSuggestionView ?? <></>,\n });\n }\n\n return (\n <div className={twMerge(\"relative h-full\", className)} {...props}>\n {BoundScrollView}\n\n {BoundFeather}\n\n {BoundInputContainer}\n </div>\n );\n}\n\nexport namespace CopilotChatView {\n // Inner component that has access to StickToBottom context\n const ScrollContent: React.FC<{\n children: React.ReactNode;\n scrollToBottomButton?: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement>>;\n inputContainerHeight: number;\n isResizing: boolean;\n }> = ({ children, scrollToBottomButton, inputContainerHeight, isResizing }) => {\n const { isAtBottom, scrollToBottom } = useStickToBottomContext();\n\n return (\n <>\n <StickToBottom.Content className=\"overflow-y-scroll overflow-x-hidden\">\n <div className=\"px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8\">{children}</div>\n </StickToBottom.Content>\n\n {/* Scroll to bottom button - hidden during resize */}\n {!isAtBottom && !isResizing && (\n <div\n className=\"absolute inset-x-0 flex justify-center z-10 pointer-events-none\"\n style={{\n bottom: `${inputContainerHeight + 16}px`,\n }}\n >\n {renderSlot(scrollToBottomButton, CopilotChatView.ScrollToBottomButton, {\n onClick: () => scrollToBottom(),\n })}\n </div>\n )}\n </>\n );\n };\n\n export const ScrollView: React.FC<\n React.HTMLAttributes<HTMLDivElement> & {\n autoScroll?: boolean;\n scrollToBottomButton?: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement>>;\n inputContainerHeight?: number;\n isResizing?: boolean;\n }\n > = ({\n children,\n autoScroll = true,\n scrollToBottomButton,\n inputContainerHeight = 0,\n isResizing = false,\n className,\n ...props\n }) => {\n const [hasMounted, setHasMounted] = useState(false);\n const { scrollRef, contentRef, scrollToBottom } = useStickToBottom();\n const [showScrollButton, setShowScrollButton] = useState(false);\n\n useEffect(() => {\n setHasMounted(true);\n }, []);\n\n // Monitor scroll position for non-autoscroll mode\n useEffect(() => {\n if (autoScroll) return; // Skip for autoscroll mode\n\n const scrollElement = scrollRef.current;\n if (!scrollElement) return;\n\n const checkScroll = () => {\n const atBottom = scrollElement.scrollHeight - scrollElement.scrollTop - scrollElement.clientHeight < 10;\n setShowScrollButton(!atBottom);\n };\n\n checkScroll();\n scrollElement.addEventListener(\"scroll\", checkScroll);\n\n // Also check on resize\n const resizeObserver = new ResizeObserver(checkScroll);\n resizeObserver.observe(scrollElement);\n\n return () => {\n scrollElement.removeEventListener(\"scroll\", checkScroll);\n resizeObserver.disconnect();\n };\n }, [scrollRef, autoScroll]);\n\n if (!hasMounted) {\n return (\n <div className=\"h-full max-h-full flex flex-col min-h-0 overflow-y-scroll overflow-x-hidden\">\n <div className=\"px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8\">{children}</div>\n </div>\n );\n }\n\n // When autoScroll is false, we don't use StickToBottom\n if (!autoScroll) {\n return (\n <div\n ref={scrollRef}\n className={cn(\n \"h-full max-h-full flex flex-col min-h-0 overflow-y-scroll overflow-x-hidden relative\",\n className,\n )}\n {...props}\n >\n <div ref={contentRef} className=\"px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8\">\n {children}\n </div>\n\n {/* Scroll to bottom button for manual mode */}\n {showScrollButton && !isResizing && (\n <div\n className=\"absolute inset-x-0 flex justify-center z-10 pointer-events-none\"\n style={{\n bottom: `${inputContainerHeight + 16}px`,\n }}\n >\n {renderSlot(scrollToBottomButton, CopilotChatView.ScrollToBottomButton, {\n onClick: () => scrollToBottom(),\n })}\n </div>\n )}\n </div>\n );\n }\n\n return (\n <StickToBottom\n className={cn(\"h-full max-h-full flex flex-col min-h-0 relative\", className)}\n resize=\"smooth\"\n initial=\"smooth\"\n {...props}\n >\n <ScrollContent\n scrollToBottomButton={scrollToBottomButton}\n inputContainerHeight={inputContainerHeight}\n isResizing={isResizing}\n >\n {children}\n </ScrollContent>\n </StickToBottom>\n );\n };\n\n export const ScrollToBottomButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement>> = ({\n className,\n ...props\n }) => (\n <Button\n variant=\"outline\"\n size=\"sm\"\n className={twMerge(\n \"rounded-full w-10 h-10 p-0 pointer-events-auto\",\n \"bg-white dark:bg-gray-900\",\n \"shadow-lg border border-gray-200 dark:border-gray-700\",\n \"hover:bg-gray-50 dark:hover:bg-gray-800\",\n \"flex items-center justify-center cursor-pointer\",\n className,\n )}\n {...props}\n >\n <ChevronDown className=\"w-4 h-4 text-gray-600 dark:text-white\" />\n </Button>\n );\n\n export const Feather: React.FC<React.HTMLAttributes<HTMLDivElement>> = ({ className, style, ...props }) => (\n <div\n className={cn(\n \"absolute bottom-0 left-0 right-4 h-24 pointer-events-none z-10 bg-gradient-to-t\",\n \"from-white via-white to-transparent\",\n \"dark:from-[rgb(33,33,33)] dark:via-[rgb(33,33,33)]\",\n className,\n )}\n style={style}\n {...props}\n />\n );\n\n export const InputContainer = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement> & { children: React.ReactNode }\n >(({ children, className, ...props }, ref) => (\n <div ref={ref} className={cn(\"absolute bottom-0 left-0 right-0 z-20 pointer-events-none\", className)} {...props}>\n {children}\n </div>\n ));\n\n InputContainer.displayName = \"CopilotChatView.InputContainer\";\n\n export const Disclaimer: React.FC<React.HTMLAttributes<HTMLDivElement>> = ({ className, ...props }) => {\n const config = useCopilotChatConfiguration();\n const labels = config?.labels ?? CopilotChatDefaultLabels;\n\n return (\n <div\n className={cn(\"text-center text-xs text-muted-foreground py-3 px-4 max-w-3xl mx-auto\", className)}\n {...props}\n >\n {labels.chatDisclaimerText}\n </div>\n );\n };\n}\n\nexport default CopilotChatView;\n","import { useAgent } from \"@/hooks/use-agent\";\nimport { useSuggestions } from \"@/hooks/use-suggestions\";\nimport { CopilotChatView, CopilotChatViewProps } from \"./CopilotChatView\";\nimport {\n CopilotChatConfigurationProvider,\n CopilotChatLabels,\n useCopilotChatConfiguration,\n} from \"@/providers/CopilotChatConfigurationProvider\";\nimport { DEFAULT_AGENT_ID, randomUUID } from \"@copilotkitnext/shared\";\nimport { Suggestion } from \"@copilotkitnext/core\";\nimport { useCallback, useEffect, useMemo } from \"react\";\nimport { merge } from \"ts-deepmerge\";\nimport { useCopilotKit } from \"@/providers/CopilotKitProvider\";\nimport { AbstractAgent, AGUIConnectNotImplementedError } from \"@ag-ui/client\";\nimport { renderSlot, SlotValue } from \"@/lib/slots\";\n\nexport type CopilotChatProps = Omit<\n CopilotChatViewProps,\n \"messages\" | \"isRunning\" | \"suggestions\" | \"suggestionLoadingIndexes\" | \"onSelectSuggestion\"\n> & {\n agentId?: string;\n threadId?: string;\n labels?: Partial<CopilotChatLabels>;\n chatView?: SlotValue<typeof CopilotChatView>;\n isModalDefaultOpen?: boolean;\n};\nexport function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen, ...props }: CopilotChatProps) {\n // Check for existing configuration provider\n const existingConfig = useCopilotChatConfiguration();\n\n // Apply priority: props > existing config > defaults\n const resolvedAgentId = agentId ?? existingConfig?.agentId ?? DEFAULT_AGENT_ID;\n const resolvedThreadId = useMemo(\n () => threadId ?? existingConfig?.threadId ?? randomUUID(),\n [threadId, existingConfig?.threadId],\n );\n const { agent } = useAgent({ agentId: resolvedAgentId });\n const { copilotkit } = useCopilotKit();\n\n const { suggestions: autoSuggestions } = useSuggestions({ agentId: resolvedAgentId });\n\n const {\n inputProps: providedInputProps,\n messageView: providedMessageView,\n suggestionView: providedSuggestionView,\n ...restProps\n } = props;\n\n useEffect(() => {\n const connect = async (agent: AbstractAgent) => {\n try {\n await copilotkit.connectAgent({ agent });\n } catch (error) {\n if (error instanceof AGUIConnectNotImplementedError) {\n // connect not implemented, ignore\n } else {\n throw error;\n }\n }\n };\n if (agent) {\n agent.threadId = resolvedThreadId;\n connect(agent);\n }\n return () => {};\n }, [resolvedThreadId, agent, copilotkit, resolvedAgentId]);\n\n const onSubmitInput = useCallback(\n async (value: string) => {\n agent?.addMessage({\n id: randomUUID(),\n role: \"user\",\n content: value,\n });\n if (agent) {\n try {\n await copilotkit.runAgent({ agent });\n } catch (error) {\n console.error(\"CopilotChat: runAgent failed\", error);\n }\n }\n },\n [agent, copilotkit],\n );\n\n const handleSelectSuggestion = useCallback(\n async (suggestion: Suggestion) => {\n if (!agent) {\n return;\n }\n\n agent.addMessage({\n id: randomUUID(),\n role: \"user\",\n content: suggestion.message,\n });\n\n try {\n await copilotkit.runAgent({ agent });\n } catch (error) {\n console.error(\"CopilotChat: runAgent failed after selecting suggestion\", error);\n }\n },\n [agent, copilotkit],\n );\n\n const mergedProps = merge(\n {\n isRunning: agent?.isRunning ?? false,\n suggestions: autoSuggestions,\n onSelectSuggestion: handleSelectSuggestion,\n suggestionView: providedSuggestionView,\n },\n {\n ...restProps,\n ...(typeof providedMessageView === \"string\"\n ? { messageView: { className: providedMessageView } }\n : providedMessageView !== undefined\n ? { messageView: providedMessageView }\n : {}),\n },\n );\n\n const finalProps = merge(mergedProps, {\n messages: agent?.messages ?? [],\n inputProps: {\n onSubmitMessage: onSubmitInput,\n ...providedInputProps,\n },\n }) as CopilotChatViewProps;\n\n // Always create a provider with merged values\n // This ensures priority: props > existing config > defaults\n const RenderedChatView = renderSlot(chatView, CopilotChatView, finalProps);\n\n return (\n <CopilotChatConfigurationProvider\n agentId={resolvedAgentId}\n threadId={resolvedThreadId}\n labels={labels}\n isModalDefaultOpen={isModalDefaultOpen}\n >\n {RenderedChatView}\n </CopilotChatConfigurationProvider>\n );\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace CopilotChat {\n export const View = CopilotChatView;\n}\n","import React, { useState, MouseEvent } from \"react\";\nimport { MessageCircle, X } from \"lucide-react\";\n\nimport { renderSlot, SlotValue } from \"@/lib/slots\";\nimport { cn } from \"@/lib/utils\";\nimport {\n CopilotChatDefaultLabels,\n useCopilotChatConfiguration,\n} from \"@/providers/CopilotChatConfigurationProvider\";\n\nconst DefaultOpenIcon: React.FC<React.SVGProps<SVGSVGElement>> = ({\n className,\n ...props\n}) => (\n <MessageCircle className={cn(\"h-6 w-6\", className)} strokeWidth={1.75} fill=\"currentColor\" {...props} />\n);\n\nconst DefaultCloseIcon: React.FC<React.SVGProps<SVGSVGElement>> = ({\n className,\n ...props\n}) => <X className={cn(\"h-6 w-6\", className)} strokeWidth={1.75} {...props} />;\n\nDefaultOpenIcon.displayName = \"CopilotChatToggleButton.OpenIcon\";\nDefaultCloseIcon.displayName = \"CopilotChatToggleButton.CloseIcon\";\n\nexport interface CopilotChatToggleButtonProps\n extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"children\"> {\n /** Optional slot override for the chat (closed) icon. */\n openIcon?: SlotValue<typeof DefaultOpenIcon>;\n /** Optional slot override for the close icon. */\n closeIcon?: SlotValue<typeof DefaultCloseIcon>;\n}\n\nconst ICON_TRANSITION_STYLE: React.CSSProperties = Object.freeze({\n transition: \"opacity 120ms ease-out, transform 260ms cubic-bezier(0.22, 1, 0.36, 1)\",\n});\n\nconst ICON_WRAPPER_BASE =\n \"pointer-events-none absolute inset-0 flex items-center justify-center will-change-transform\";\n\nconst BUTTON_BASE_CLASSES = cn(\n \"fixed bottom-6 right-6 z-[1100] flex h-14 w-14 items-center justify-center\",\n \"rounded-full border border-primary bg-primary text-primary-foreground\",\n \"shadow-sm transition-all duration-200 ease-out\",\n \"hover:scale-[1.04] hover:shadow-md\",\n \"cursor-pointer\",\n \"active:scale-[0.96]\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n \"disabled:pointer-events-none disabled:opacity-60\"\n);\n\nexport const CopilotChatToggleButton = React.forwardRef<\n HTMLButtonElement,\n CopilotChatToggleButtonProps\n>(function CopilotChatToggleButton({ openIcon, closeIcon, className, ...buttonProps }, ref) {\n const { onClick, type, disabled, ...restProps } = buttonProps;\n\n const configuration = useCopilotChatConfiguration();\n const labels = configuration?.labels ?? CopilotChatDefaultLabels;\n\n const [fallbackOpen, setFallbackOpen] = useState(false);\n\n const isOpen = configuration?.isModalOpen ?? fallbackOpen;\n const setModalOpen = configuration?.setModalOpen ?? setFallbackOpen;\n\n const handleClick = (event: MouseEvent<HTMLButtonElement>) => {\n if (disabled) {\n return;\n }\n\n if (onClick) {\n onClick(event);\n }\n\n if (event.defaultPrevented) {\n return;\n }\n\n const nextOpen = !isOpen;\n setModalOpen(nextOpen);\n };\n\n const renderedOpenIcon = renderSlot(\n openIcon,\n DefaultOpenIcon,\n {\n className: \"h-6 w-6\",\n \"aria-hidden\": true,\n focusable: false,\n }\n );\n\n const renderedCloseIcon = renderSlot(\n closeIcon,\n DefaultCloseIcon,\n {\n className: \"h-6 w-6\",\n \"aria-hidden\": true,\n focusable: false,\n }\n );\n\n const openIconElement = (\n <span\n aria-hidden=\"true\"\n data-slot=\"chat-toggle-button-open-icon\"\n className={ICON_WRAPPER_BASE}\n style={{\n ...ICON_TRANSITION_STYLE,\n opacity: isOpen ? 0 : 1,\n transform: `scale(${isOpen ? 0.75 : 1}) rotate(${isOpen ? 90 : 0}deg)`,\n }}\n >\n {renderedOpenIcon}\n </span>\n );\n\n const closeIconElement = (\n <span\n aria-hidden=\"true\"\n data-slot=\"chat-toggle-button-close-icon\"\n className={ICON_WRAPPER_BASE}\n style={{\n ...ICON_TRANSITION_STYLE,\n opacity: isOpen ? 1 : 0,\n transform: `scale(${isOpen ? 1 : 0.75}) rotate(${isOpen ? 0 : -90}deg)`,\n }}\n >\n {renderedCloseIcon}\n </span>\n );\n\n return (\n <button\n ref={ref}\n type={type ?? \"button\"}\n data-slot=\"chat-toggle-button\"\n data-state={isOpen ? \"open\" : \"closed\"}\n className={cn(BUTTON_BASE_CLASSES, className)}\n aria-label={isOpen ? labels.chatToggleCloseLabel : labels.chatToggleOpenLabel}\n aria-pressed={isOpen}\n disabled={disabled}\n onClick={handleClick}\n {...restProps}\n >\n {openIconElement}\n {closeIconElement}\n </button>\n );\n});\nCopilotChatToggleButton.displayName = \"CopilotChatToggleButton\";\nexport default CopilotChatToggleButton;\n\nexport {\n DefaultOpenIcon as CopilotChatToggleButtonOpenIcon,\n DefaultCloseIcon as CopilotChatToggleButtonCloseIcon,\n};\n","import React, { useEffect, useRef, useState } from \"react\";\n\nimport CopilotChatView, { CopilotChatViewProps } from \"./CopilotChatView\";\nimport { useCopilotChatConfiguration } from \"@/providers/CopilotChatConfigurationProvider\";\nimport CopilotChatToggleButton from \"./CopilotChatToggleButton\";\nimport { cn } from \"@/lib/utils\";\nimport { CopilotModalHeader } from \"./CopilotModalHeader\";\nimport { renderSlot, SlotValue } from \"@/lib/slots\";\n\nconst DEFAULT_SIDEBAR_WIDTH = 480;\nconst SIDEBAR_TRANSITION_MS = 260;\n\nexport type CopilotSidebarViewProps = CopilotChatViewProps & {\n header?: SlotValue<typeof CopilotModalHeader>;\n width?: number | string;\n};\n\nexport function CopilotSidebarView({ header, width, ...props }: CopilotSidebarViewProps) {\n const configuration = useCopilotChatConfiguration();\n\n const isSidebarOpen = configuration?.isModalOpen ?? false;\n\n const sidebarRef = useRef<HTMLDivElement | null>(null);\n const [sidebarWidth, setSidebarWidth] = useState<number | string>(width ?? DEFAULT_SIDEBAR_WIDTH);\n\n // Helper to convert width to CSS value\n const widthToCss = (w: number | string): string => {\n return typeof w === \"number\" ? `${w}px` : w;\n };\n\n // Helper to extract numeric value for body margin (only works with px values)\n const widthToMargin = (w: number | string): string => {\n if (typeof w === \"number\") {\n return `${w}px`;\n }\n // For string values, use as-is (assumes valid CSS unit)\n return w;\n };\n\n useEffect(() => {\n // If width is explicitly provided, don't measure\n if (width !== undefined) {\n return;\n }\n\n if (typeof window === \"undefined\") {\n return;\n }\n\n const element = sidebarRef.current;\n if (!element) {\n return;\n }\n\n const updateWidth = () => {\n const rect = element.getBoundingClientRect();\n if (rect.width > 0) {\n setSidebarWidth(rect.width);\n }\n };\n\n updateWidth();\n\n if (typeof ResizeObserver !== \"undefined\") {\n const observer = new ResizeObserver(() => updateWidth());\n observer.observe(element);\n return () => observer.disconnect();\n }\n\n window.addEventListener(\"resize\", updateWidth);\n return () => window.removeEventListener(\"resize\", updateWidth);\n }, [width]);\n\n const headerElement = renderSlot(header, CopilotModalHeader, {});\n\n return (\n <>\n {isSidebarOpen && (\n <style\n dangerouslySetInnerHTML={{\n __html: `body {\n margin-inline-end: ${widthToMargin(sidebarWidth)};\n transition: margin-inline-end ${SIDEBAR_TRANSITION_MS}ms ease;\n }`,\n }}\n />\n )}\n <CopilotChatToggleButton />\n <aside\n ref={sidebarRef}\n data-copilot-sidebar\n className={cn(\n \"fixed right-0 top-0 z-[1200] flex h-dvh max-h-screen\",\n \"border-l border-border bg-background text-foreground shadow-xl\",\n \"transition-transform duration-300 ease-out\",\n isSidebarOpen ? \"translate-x-0\" : \"translate-x-full pointer-events-none\",\n )}\n style={{ width: widthToCss(sidebarWidth) }}\n aria-hidden={!isSidebarOpen}\n aria-label=\"Copilot chat sidebar\"\n role=\"complementary\"\n >\n <div className=\"flex h-full w-full flex-col overflow-hidden\">\n {headerElement}\n <div className=\"flex-1 overflow-hidden\" data-sidebar-chat>\n <CopilotChatView {...props} />\n </div>\n </div>\n </aside>\n </>\n );\n}\n\nCopilotSidebarView.displayName = \"CopilotSidebarView\";\n\nexport default CopilotSidebarView;\n","import React, { useCallback } from \"react\";\n\nimport { cn } from \"@/lib/utils\";\nimport { useCopilotChatConfiguration, CopilotChatDefaultLabels } from \"@/providers/CopilotChatConfigurationProvider\";\nimport { renderSlot, WithSlots } from \"@/lib/slots\";\nimport { X } from \"lucide-react\";\n\ntype HeaderSlots = {\n titleContent: typeof CopilotModalHeader.Title;\n closeButton: typeof CopilotModalHeader.CloseButton;\n};\n\ntype HeaderRestProps = {\n title?: string;\n} & Omit<React.HTMLAttributes<HTMLDivElement>, \"children\">;\n\nexport type CopilotModalHeaderProps = WithSlots<HeaderSlots, HeaderRestProps>;\n\nexport function CopilotModalHeader({\n title,\n titleContent,\n closeButton,\n children,\n className,\n ...rest\n}: CopilotModalHeaderProps) {\n const configuration = useCopilotChatConfiguration();\n\n const fallbackTitle = configuration?.labels.modalHeaderTitle ?? CopilotChatDefaultLabels.modalHeaderTitle;\n const resolvedTitle = title ?? fallbackTitle;\n\n const handleClose = useCallback(() => {\n configuration?.setModalOpen(false);\n }, [configuration]);\n\n const BoundTitle = renderSlot(titleContent, CopilotModalHeader.Title, {\n children: resolvedTitle,\n });\n\n const BoundCloseButton = renderSlot(closeButton, CopilotModalHeader.CloseButton, {\n onClick: handleClose,\n });\n\n if (children) {\n return children({\n titleContent: BoundTitle,\n closeButton: BoundCloseButton,\n title: resolvedTitle,\n ...rest,\n });\n }\n\n return (\n <header\n data-slot=\"copilot-modal-header\"\n className={cn(\n \"flex items-center justify-between border-b border-border px-4 py-4\",\n \"bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80\",\n className,\n )}\n {...rest}\n >\n <div className=\"flex w-full items-center gap-2\">\n <div className=\"flex-1\" aria-hidden=\"true\" />\n <div className=\"flex flex-1 justify-center text-center\">{BoundTitle}</div>\n <div className=\"flex flex-1 justify-end\">{BoundCloseButton}</div>\n </div>\n </header>\n );\n}\n\nCopilotModalHeader.displayName = \"CopilotModalHeader\";\n\nexport namespace CopilotModalHeader {\n export const Title: React.FC<React.HTMLAttributes<HTMLDivElement>> = ({ children, className, ...props }) => (\n <div\n className={cn(\n \"w-full text-base font-medium leading-none tracking-tight text-foreground\",\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n\n export const CloseButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement>> = ({\n className,\n ...props\n }) => (\n <button\n type=\"button\"\n className={cn(\n \"inline-flex size-8 items-center justify-center rounded-full text-muted-foreground transition cursor-pointer\",\n \"hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n className,\n )}\n aria-label=\"Close\"\n {...props}\n >\n <X className=\"h-4 w-4\" aria-hidden=\"true\" />\n </button>\n );\n}\n\nCopilotModalHeader.Title.displayName = \"CopilotModalHeader.Title\";\nCopilotModalHeader.CloseButton.displayName = \"CopilotModalHeader.CloseButton\";\n\nexport default CopilotModalHeader;\n","import React, { useMemo } from \"react\";\n\nimport { CopilotChat, CopilotChatProps } from \"./CopilotChat\";\nimport CopilotChatView, { CopilotChatViewProps } from \"./CopilotChatView\";\nimport { CopilotSidebarView, CopilotSidebarViewProps } from \"./CopilotSidebarView\";\n\nexport type CopilotSidebarProps = Omit<CopilotChatProps, \"chatView\"> & {\n header?: CopilotSidebarViewProps[\"header\"];\n defaultOpen?: boolean;\n width?: number | string;\n};\n\nexport function CopilotSidebar({ header, defaultOpen, width, ...chatProps }: CopilotSidebarProps) {\n const SidebarViewOverride = useMemo(() => {\n const Component: React.FC<CopilotChatViewProps> = (viewProps) => {\n const { header: viewHeader, width: viewWidth, ...restProps } = viewProps as CopilotSidebarViewProps;\n\n return (\n <CopilotSidebarView\n {...(restProps as CopilotSidebarViewProps)}\n header={header ?? viewHeader}\n width={width ?? viewWidth}\n />\n );\n };\n\n return Object.assign(Component, CopilotChatView);\n }, [header, width]);\n\n return (\n <CopilotChat\n {...chatProps}\n chatView={SidebarViewOverride}\n isModalDefaultOpen={defaultOpen}\n />\n );\n}\n\nCopilotSidebar.displayName = \"CopilotSidebar\";\n\nexport default CopilotSidebar;\n","import React from \"react\";\nimport { z } from \"zod\";\nimport { ReactToolCallRender } from \"./react-tool-call-render\";\nimport { ToolCallStatus } from \"@copilotkitnext/core\";\n\n/**\n * Helper to define a type-safe tool call render entry.\n * - Accepts a single object whose keys match ReactToolCallRender's fields: { name, args, render, agentId? }.\n * - Derives `args` type from the provided Zod schema.\n * - Ensures the render function param type exactly matches ReactToolCallRender<T>[\"render\"]'s param.\n * - For wildcard tools (name: \"*\"), args is optional and defaults to z.any()\n */\ntype RenderProps<T> =\n | {\n name: string;\n args: Partial<T>;\n status: ToolCallStatus.InProgress;\n result: undefined;\n }\n | {\n name: string;\n args: T;\n status: ToolCallStatus.Executing;\n result: undefined;\n }\n | {\n name: string;\n args: T;\n status: ToolCallStatus.Complete;\n result: string;\n };\n\n// Overload for wildcard tools without args\nexport function defineToolCallRender(def: {\n name: \"*\";\n render: (props: RenderProps<any>) => React.ReactElement;\n agentId?: string;\n}): ReactToolCallRender<any>;\n\n// Overload for regular tools with args\nexport function defineToolCallRender<S extends z.ZodTypeAny>(def: {\n name: string;\n args: S;\n render: (props: RenderProps<z.infer<S>>) => React.ReactElement;\n agentId?: string;\n}): ReactToolCallRender<z.infer<S>>;\n\n// Implementation\nexport function defineToolCallRender<S extends z.ZodTypeAny>(def: {\n name: string;\n args?: S;\n render: (props: any) => React.ReactElement;\n agentId?: string;\n}): ReactToolCallRender<any> {\n // For wildcard tools, default to z.any() if no args provided\n const argsSchema = def.name === \"*\" && !def.args ? z.any() : def.args;\n\n return {\n name: def.name,\n args: argsSchema as any,\n render: def.render as React.ComponentType<any>,\n ...(def.agentId ? { agentId: def.agentId } : {}),\n };\n}\n","import { defineToolCallRender } from \"../types/defineToolCallRender\";\nimport { useState } from \"react\";\n\nexport const WildcardToolCallRender = defineToolCallRender({\n name: \"*\",\n render: ({ args, result, name, status }) => {\n const [isExpanded, setIsExpanded] = useState(false);\n\n const statusString = String(status) as\n | \"inProgress\"\n | \"executing\"\n | \"complete\";\n const isActive =\n statusString === \"inProgress\" || statusString === \"executing\";\n const isComplete = statusString === \"complete\";\n const statusStyles = isActive\n ? \"bg-amber-100 text-amber-800 dark:bg-amber-500/15 dark:text-amber-400\"\n : isComplete\n ? \"bg-emerald-100 text-emerald-800 dark:bg-emerald-500/15 dark:text-emerald-400\"\n : \"bg-zinc-100 text-zinc-800 dark:bg-zinc-700/40 dark:text-zinc-300\";\n\n return (\n <div className=\"mt-2 pb-2\">\n <div className=\"rounded-xl border border-zinc-200/60 dark:border-zinc-800/60 bg-white/70 dark:bg-zinc-900/50 shadow-sm backdrop-blur p-4\">\n <div\n className=\"flex items-center justify-between gap-3 cursor-pointer\"\n onClick={() => setIsExpanded(!isExpanded)}\n >\n <div className=\"flex items-center gap-2 min-w-0\">\n <svg\n className={`h-4 w-4 text-zinc-500 dark:text-zinc-400 transition-transform ${\n isExpanded ? \"rotate-90\" : \"\"\n }`}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth={2}\n stroke=\"currentColor\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M8.25 4.5l7.5 7.5-7.5 7.5\"\n />\n </svg>\n <span className=\"inline-block h-2 w-2 rounded-full bg-blue-500\" />\n <span className=\"truncate text-sm font-medium text-zinc-900 dark:text-zinc-100\">\n {name}\n </span>\n </div>\n <span\n className={`inline-flex items-center rounded-full px-2 py-1 text-xs font-medium ${statusStyles}`}\n >\n {String(status)}\n </span>\n </div>\n\n {isExpanded && (\n <div className=\"mt-3 grid gap-4\">\n <div>\n <div className=\"text-xs uppercase tracking-wide text-zinc-500 dark:text-zinc-400\">\n Arguments\n </div>\n <pre className=\"mt-2 max-h-64 overflow-auto rounded-md bg-zinc-50 dark:bg-zinc-800/60 p-3 text-xs leading-relaxed text-zinc-800 dark:text-zinc-200 whitespace-pre-wrap break-words\">\n {JSON.stringify(args ?? {}, null, 2)}\n </pre>\n </div>\n\n {result !== undefined && (\n <div>\n <div className=\"text-xs uppercase tracking-wide text-zinc-500 dark:text-zinc-400\">\n Result\n </div>\n <pre className=\"mt-2 max-h-64 overflow-auto rounded-md bg-zinc-50 dark:bg-zinc-800/60 p-3 text-xs leading-relaxed text-zinc-800 dark:text-zinc-200 whitespace-pre-wrap break-words\">\n {typeof result === \"string\"\n ? result\n : JSON.stringify(result, null, 2)}\n </pre>\n </div>\n )}\n </div>\n )}\n </div>\n </div>\n );\n },\n});\n"],"mappings":";AAAA,SAAgB,YAAAA,WAAU,UAAAC,SAAoC,aAAAC,YAAW,cAAAC,aAAY,uBAAAC,4BAA2B;AAChH,SAAS,WAAAC,gBAAe;AACxB,SAAS,MAAM,WAAW,KAAK,SAAS,GAAG,aAAa;;;ACFxD,SAAgB,eAAe,YAAuB,SAAS,gBAAgB;AAC/E,SAAS,kBAAkB,kBAAkB;AA0GzC;AAvGG,IAAM,2BAA2B;AAAA,EACtC,sBAAsB;AAAA,EACtB,4CAA4C;AAAA,EAC5C,6CAA6C;AAAA,EAC7C,6CAA6C;AAAA,EAC7C,gCAAgC;AAAA,EAChC,kCAAkC;AA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AA,UACA,gBAAAA,MAAC,SAAI,WAAU,sKACZ,eAAK,UAAU,QAAQ,CAAC,GAAG,MAAM,CAAC,GACrC;AAAA,WACF;AAAA,QAEC,WAAW,UACV,gBAAAC,OAAC,SACC;AAAA,0BAAAD,MAAC,SAAI,WAAU,oEAAmE,oBAElF;AAAA,UACA,gBAAAA,MAAC,SAAI,WAAU,sKACZ,iBAAO,WAAW,WACf,SACA,KAAK,UAAU,QAAQ,MAAM,CAAC,GACpC;AAAA,WACF;AAAA,SAEJ;AAAA,OAEJ,GACF;AAAA,EAEJ;AACF,CAAC;","names":["useState","useRef","useEffect","forwardRef","useImperativeHandle","twMerge","jsx","jsx","jsx","jsxs","jsx","jsx","jsx","jsx","jsxs","twMerge","jsx","React","jsx","jsxs","useState","useEffect","useRef","twMerge","CopilotChatInput","forwardRef","TextArea","useImperativeHandle","useState","Check","twMerge","useEffect","useState","createContext","useContext","useMemo","useEffect","useState","useRef","jsx","copilotkit","DEFAULT_AGENT_ID","jsx","useState","useEffect","useEffect","useEffect","useState","useCallback","useRef","useEffect","React","useState","useRef","useCallback","React","useEffect","useMemo","useEffect","useReducer","DEFAULT_AGENT_ID","DEFAULT_AGENT_ID","useReducer","useMemo","useEffect","useEffect","useCallback","useEffect","useMemo","useState","DEFAULT_AGENT_ID","useMemo","useState","useEffect","suggestions","useCallback","useCallback","useEffect","useMemo","useRef","DEFAULT_AGENT_ID","useMemo","useRef","useCallback","useEffect","React","Fragment","jsx","Fragment","jsx","jsxs","twMerge","CopilotChatAssistantMessage","useState","Check","className","useState","Copy","Check","twMerge","Fragment","jsx","jsxs","twMerge","CopilotChatUserMessage","useState","Check","Copy","React","jsx","jsxs","React","CopilotChatSuggestionPill","React","Fragment","jsx","jsxs","React","DefaultContainer","CopilotChatSuggestionView","twMerge","jsx","jsxs","React","useRef","useState","useEffect","twMerge","Fragment","jsx","jsxs","useRef","useState","useEffect","twMerge","CopilotChatView","React","DEFAULT_AGENT_ID","randomUUID","useCallback","useEffect","useMemo","jsx","DEFAULT_AGENT_ID","useMemo","randomUUID","useEffect","agent","useCallback","CopilotChat","React","useState","X","jsx","jsxs","X","React","CopilotChatToggleButton","useState","useEffect","useRef","useState","useCallback","X","jsx","jsxs","useCallback","CopilotModalHeader","Fragment","jsx","jsxs","useRef","useState","useEffect","useMemo","jsx","useMemo","z","useState","jsx","jsxs"]}
1
+ {"version":3,"sources":["../src/components/chat/CopilotChatInput.tsx","../src/providers/CopilotChatConfigurationProvider.tsx","../src/components/ui/button.tsx","../src/lib/utils.ts","../src/components/ui/tooltip.tsx","../src/components/ui/dropdown-menu.tsx","../src/components/chat/CopilotChatAudioRecorder.tsx","../src/lib/slots.tsx","../src/components/chat/CopilotChatAssistantMessage.tsx","../src/hooks/use-render-tool-call.tsx","../src/providers/CopilotKitProvider.tsx","../src/hooks/use-frontend-tool.tsx","../src/hooks/use-human-in-the-loop.tsx","../src/hooks/use-agent.tsx","../src/hooks/use-agent-context.tsx","../src/hooks/use-suggestions.tsx","../src/hooks/use-configure-suggestions.tsx","../src/components/chat/CopilotChatToolCallsView.tsx","../src/components/chat/CopilotChatUserMessage.tsx","../src/components/chat/CopilotChatSuggestionPill.tsx","../src/components/chat/CopilotChatSuggestionView.tsx","../src/components/chat/CopilotChatMessageView.tsx","../src/components/chat/CopilotChatView.tsx","../src/components/chat/CopilotChat.tsx","../src/components/chat/CopilotChatToggleButton.tsx","../src/components/chat/CopilotSidebarView.tsx","../src/components/chat/CopilotModalHeader.tsx","../src/components/chat/CopilotSidebar.tsx","../src/types/defineToolCallRender.ts","../src/components/WildcardToolCallRender.tsx"],"sourcesContent":["import React, { useState, useRef, KeyboardEvent, ChangeEvent, useEffect, forwardRef, useImperativeHandle } from \"react\";\nimport { twMerge } from \"tailwind-merge\";\nimport { Plus, Settings2, Mic, ArrowUp, X, Check } from \"lucide-react\";\n\nimport {\n CopilotChatLabels,\n useCopilotChatConfiguration,\n CopilotChatDefaultLabels,\n} from \"@/providers/CopilotChatConfigurationProvider\";\nimport { Button } from \"@/components/ui/button\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"@/components/ui/tooltip\";\nimport {\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuSub,\n DropdownMenuSubTrigger,\n DropdownMenuSubContent,\n DropdownMenuSeparator,\n} from \"@/components/ui/dropdown-menu\";\n\nimport { CopilotChatAudioRecorder } from \"./CopilotChatAudioRecorder\";\nimport { renderSlot, WithSlots } from \"@/lib/slots\";\n\nexport type CopilotChatInputMode = \"input\" | \"transcribe\" | \"processing\";\n\nexport type ToolsMenuItem = {\n label: string;\n} & (\n | {\n action: () => void;\n items?: never;\n }\n | {\n action?: never;\n items: (ToolsMenuItem | \"-\")[];\n }\n);\n\nexport type CopilotChatInputProps = WithSlots<\n {\n textArea: typeof CopilotChatInput.TextArea;\n sendButton: typeof CopilotChatInput.SendButton;\n startTranscribeButton: typeof CopilotChatInput.StartTranscribeButton;\n cancelTranscribeButton: typeof CopilotChatInput.CancelTranscribeButton;\n finishTranscribeButton: typeof CopilotChatInput.FinishTranscribeButton;\n addFileButton: typeof CopilotChatInput.AddFileButton;\n toolsButton: typeof CopilotChatInput.ToolsButton;\n toolbar: typeof CopilotChatInput.Toolbar;\n audioRecorder: typeof CopilotChatAudioRecorder;\n },\n {\n mode?: CopilotChatInputMode;\n toolsMenu?: (ToolsMenuItem | \"-\")[];\n autoFocus?: boolean;\n additionalToolbarItems?: React.ReactNode;\n onSubmitMessage?: (value: string) => void;\n onStartTranscribe?: () => void;\n onCancelTranscribe?: () => void;\n onFinishTranscribe?: () => void;\n onAddFile?: () => void;\n value?: string;\n onChange?: (value: string) => void;\n } & Omit<React.HTMLAttributes<HTMLDivElement>, \"onChange\">\n>;\n\nexport function CopilotChatInput({\n mode = \"input\",\n onSubmitMessage,\n onStartTranscribe,\n onCancelTranscribe,\n onFinishTranscribe,\n onAddFile,\n onChange,\n value,\n toolsMenu,\n autoFocus = true,\n additionalToolbarItems,\n textArea,\n sendButton,\n startTranscribeButton,\n cancelTranscribeButton,\n finishTranscribeButton,\n addFileButton,\n toolsButton,\n toolbar,\n audioRecorder,\n children,\n className,\n ...props\n}: CopilotChatInputProps) {\n const isControlled = value !== undefined;\n const [internalValue, setInternalValue] = useState<string>(() => value ?? \"\");\n\n useEffect(() => {\n if (!isControlled && value !== undefined) {\n setInternalValue(value);\n }\n }, [isControlled, value]);\n\n const resolvedValue = isControlled ? (value ?? \"\") : internalValue;\n\n const inputRef = useRef<HTMLTextAreaElement>(null);\n const audioRecorderRef = useRef<React.ElementRef<typeof CopilotChatAudioRecorder>>(null);\n const config = useCopilotChatConfiguration();\n\n const previousModalStateRef = useRef<boolean | undefined>(undefined);\n\n useEffect(() => {\n if (!autoFocus) {\n previousModalStateRef.current = config?.isModalOpen;\n return;\n }\n\n if (config?.isModalOpen && !previousModalStateRef.current) {\n inputRef.current?.focus();\n }\n\n previousModalStateRef.current = config?.isModalOpen;\n }, [config?.isModalOpen, autoFocus]);\n\n // Handle recording based on mode changes\n useEffect(() => {\n const recorder = audioRecorderRef.current;\n if (!recorder) {\n return;\n }\n\n if (mode === \"transcribe\") {\n // Start recording when entering transcribe mode\n recorder.start().catch(console.error);\n } else {\n // Stop recording when leaving transcribe mode\n if (recorder.state === \"recording\") {\n recorder.stop().catch(console.error);\n }\n }\n }, [mode]);\n\n // Handlers\n const handleChange = (e: ChangeEvent<HTMLTextAreaElement>) => {\n const nextValue = e.target.value;\n if (!isControlled) {\n setInternalValue(nextValue);\n }\n onChange?.(nextValue);\n };\n\n const handleKeyDown = (e: KeyboardEvent<HTMLTextAreaElement>) => {\n if (e.key === \"Enter\" && !e.shiftKey) {\n e.preventDefault();\n send();\n }\n };\n\n const send = () => {\n if (!onSubmitMessage) {\n return;\n }\n const trimmed = resolvedValue.trim();\n if (!trimmed) {\n return;\n }\n\n onSubmitMessage(trimmed);\n\n if (!isControlled) {\n setInternalValue(\"\");\n onChange?.(\"\");\n }\n\n if (inputRef.current) {\n inputRef.current.focus();\n }\n };\n\n const BoundTextArea = renderSlot(textArea, CopilotChatInput.TextArea, {\n ref: inputRef,\n value: resolvedValue,\n onChange: handleChange,\n onKeyDown: handleKeyDown,\n autoFocus: autoFocus,\n });\n\n const BoundAudioRecorder = renderSlot(audioRecorder, CopilotChatAudioRecorder, {\n ref: audioRecorderRef,\n });\n\n const BoundSendButton = renderSlot(sendButton, CopilotChatInput.SendButton, {\n onClick: send,\n disabled: !resolvedValue.trim() || !onSubmitMessage,\n });\n\n const BoundStartTranscribeButton = renderSlot(startTranscribeButton, CopilotChatInput.StartTranscribeButton, {\n onClick: onStartTranscribe,\n });\n\n const BoundCancelTranscribeButton = renderSlot(cancelTranscribeButton, CopilotChatInput.CancelTranscribeButton, {\n onClick: onCancelTranscribe,\n });\n\n const BoundFinishTranscribeButton = renderSlot(finishTranscribeButton, CopilotChatInput.FinishTranscribeButton, {\n onClick: onFinishTranscribe,\n });\n\n const BoundAddFileButton = renderSlot(addFileButton, CopilotChatInput.AddFileButton, {\n onClick: onAddFile,\n disabled: mode === \"transcribe\",\n });\n\n const BoundToolsButton = renderSlot(toolsButton, CopilotChatInput.ToolsButton, {\n disabled: mode === \"transcribe\",\n toolsMenu: toolsMenu,\n });\n\n const BoundToolbar = renderSlot(\n typeof toolbar === \"string\" || toolbar === undefined\n ? twMerge(toolbar, \"w-full h-[60px] bg-transparent flex items-center justify-between\")\n : toolbar,\n CopilotChatInput.Toolbar,\n {\n children: (\n <>\n <div className=\"flex items-center\">\n {onAddFile && BoundAddFileButton}\n {BoundToolsButton}\n {additionalToolbarItems}\n </div>\n <div className=\"flex items-center\">\n {mode === \"transcribe\" ? (\n <>\n {onCancelTranscribe && BoundCancelTranscribeButton}\n {onFinishTranscribe && BoundFinishTranscribeButton}\n </>\n ) : (\n <>\n {onStartTranscribe && BoundStartTranscribeButton}\n {BoundSendButton}\n </>\n )}\n </div>\n </>\n ),\n },\n );\n\n if (children) {\n return (\n <>\n {children({\n textArea: BoundTextArea,\n audioRecorder: BoundAudioRecorder,\n sendButton: BoundSendButton,\n startTranscribeButton: BoundStartTranscribeButton,\n cancelTranscribeButton: BoundCancelTranscribeButton,\n finishTranscribeButton: BoundFinishTranscribeButton,\n addFileButton: BoundAddFileButton,\n toolsButton: BoundToolsButton,\n toolbar: BoundToolbar,\n onSubmitMessage,\n onStartTranscribe,\n onCancelTranscribe,\n onFinishTranscribe,\n onAddFile,\n mode,\n toolsMenu,\n autoFocus,\n additionalToolbarItems,\n })}\n </>\n );\n }\n\n const handleContainerClick = (e: React.MouseEvent<HTMLDivElement>) => {\n // Don't focus if clicking on buttons or other interactive elements\n const target = e.target as HTMLElement;\n if (target.tagName !== \"BUTTON\" && !target.closest(\"button\") && inputRef.current && mode === \"input\") {\n inputRef.current.focus();\n }\n };\n\n return (\n <div\n className={twMerge(\n // Layout\n \"flex w-full flex-col items-center justify-center\",\n // Interaction\n \"cursor-text\",\n // Overflow and clipping\n \"overflow-visible bg-clip-padding contain-inline-size\",\n // Background\n \"bg-white dark:bg-[#303030]\",\n // Visual effects\n \"shadow-[0_4px_4px_0_#0000000a,0_0_1px_0_#0000009e] rounded-[28px]\",\n className,\n )}\n onClick={handleContainerClick}\n {...props}\n >\n {mode === \"transcribe\" ? BoundAudioRecorder : BoundTextArea}\n {BoundToolbar}\n </div>\n );\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace CopilotChatInput {\n export const SendButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement>> = ({ className, ...props }) => (\n <div className=\"mr-[10px]\">\n <Button\n type=\"button\"\n variant=\"chatInputToolbarPrimary\"\n size=\"chatInputToolbarIcon\"\n className={className}\n {...props}\n >\n <ArrowUp className=\"size-[18px]\" />\n </Button>\n </div>\n );\n\n export const ToolbarButton: React.FC<\n React.ButtonHTMLAttributes<HTMLButtonElement> & {\n icon: React.ReactNode;\n labelKey: keyof CopilotChatLabels;\n defaultClassName?: string;\n }\n > = ({ icon, labelKey, defaultClassName, className, ...props }) => {\n const config = useCopilotChatConfiguration();\n const labels = config?.labels ?? CopilotChatDefaultLabels;\n return (\n <Tooltip>\n <TooltipTrigger asChild>\n <Button\n type=\"button\"\n variant=\"chatInputToolbarSecondary\"\n size=\"chatInputToolbarIcon\"\n className={twMerge(defaultClassName, className)}\n {...props}\n >\n {icon}\n </Button>\n </TooltipTrigger>\n <TooltipContent side=\"bottom\">\n <p>{labels[labelKey]}</p>\n </TooltipContent>\n </Tooltip>\n );\n };\n\n export const StartTranscribeButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement>> = (props) => (\n <ToolbarButton\n icon={<Mic className=\"size-[18px]\" />}\n labelKey=\"chatInputToolbarStartTranscribeButtonLabel\"\n defaultClassName=\"mr-2\"\n {...props}\n />\n );\n\n export const CancelTranscribeButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement>> = (props) => (\n <ToolbarButton\n icon={<X className=\"size-[18px]\" />}\n labelKey=\"chatInputToolbarCancelTranscribeButtonLabel\"\n defaultClassName=\"mr-2\"\n {...props}\n />\n );\n\n export const FinishTranscribeButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement>> = (props) => (\n <ToolbarButton\n icon={<Check className=\"size-[18px]\" />}\n labelKey=\"chatInputToolbarFinishTranscribeButtonLabel\"\n defaultClassName=\"mr-[10px]\"\n {...props}\n />\n );\n\n export const AddFileButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement>> = (props) => (\n <ToolbarButton\n icon={<Plus className=\"size-[20px]\" />}\n labelKey=\"chatInputToolbarAddButtonLabel\"\n defaultClassName=\"ml-2\"\n {...props}\n />\n );\n\n export const ToolsButton: React.FC<\n React.ButtonHTMLAttributes<HTMLButtonElement> & {\n toolsMenu?: (ToolsMenuItem | \"-\")[];\n }\n > = ({ className, toolsMenu, ...props }) => {\n const config = useCopilotChatConfiguration();\n const labels = config?.labels ?? CopilotChatDefaultLabels;\n\n const renderMenuItems = (items: (ToolsMenuItem | \"-\")[]): React.ReactNode => {\n return items.map((item, index) => {\n if (item === \"-\") {\n // Separator\n return <DropdownMenuSeparator key={index} />;\n } else if (item.items && item.items.length > 0) {\n // Nested menu\n return (\n <DropdownMenuSub key={index}>\n <DropdownMenuSubTrigger>{item.label}</DropdownMenuSubTrigger>\n <DropdownMenuSubContent>{renderMenuItems(item.items)}</DropdownMenuSubContent>\n </DropdownMenuSub>\n );\n } else {\n // Regular menu item\n return (\n <DropdownMenuItem key={index} onClick={item.action}>\n {item.label}\n </DropdownMenuItem>\n );\n }\n });\n };\n\n // Only render if toolsMenu is provided and has items\n if (!toolsMenu || toolsMenu.length === 0) {\n return null;\n }\n\n // Render dropdown menu\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button\n type=\"button\"\n variant=\"chatInputToolbarSecondary\"\n size=\"chatInputToolbarIconLabel\"\n className={className}\n {...props}\n >\n <Settings2 className=\"size-[18px]\" />\n <span className=\"text-sm font-normal\">{labels.chatInputToolbarToolsButtonLabel}</span>\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent side=\"top\" align=\"end\">\n {renderMenuItems(toolsMenu)}\n </DropdownMenuContent>\n </DropdownMenu>\n );\n };\n\n export const Toolbar: React.FC<React.HTMLAttributes<HTMLDivElement>> = ({ className, ...props }) => (\n <div className={twMerge(\"w-full h-[60px] bg-transparent flex items-center\", className)} {...props} />\n );\n\n export interface TextAreaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {\n maxRows?: number;\n }\n\n export const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(function TextArea(\n { maxRows = 5, style, className, ...props },\n ref,\n ) {\n const internalTextareaRef = useRef<HTMLTextAreaElement>(null);\n const [maxHeight, setMaxHeight] = useState<number>(0);\n\n const config = useCopilotChatConfiguration();\n const labels = config?.labels ?? CopilotChatDefaultLabels;\n\n useImperativeHandle(ref, () => internalTextareaRef.current as HTMLTextAreaElement);\n\n const adjustHeight = () => {\n const textarea = internalTextareaRef.current;\n if (textarea && maxHeight > 0) {\n textarea.style.height = \"auto\";\n textarea.style.height = `${Math.min(textarea.scrollHeight, maxHeight)}px`;\n }\n };\n\n useEffect(() => {\n const calculateMaxHeight = () => {\n const textarea = internalTextareaRef.current;\n if (textarea) {\n // Save current value\n const currentValue = textarea.value;\n // Clear content to measure single row height\n textarea.value = \"\";\n textarea.style.height = \"auto\";\n\n // Get computed styles to account for padding\n const computedStyle = window.getComputedStyle(textarea);\n const paddingTop = parseFloat(computedStyle.paddingTop);\n const paddingBottom = parseFloat(computedStyle.paddingBottom);\n\n // Calculate actual content height (without padding)\n const contentHeight = textarea.scrollHeight - paddingTop - paddingBottom;\n\n // Calculate max height: content height for maxRows + padding\n setMaxHeight(contentHeight * maxRows + paddingTop + paddingBottom);\n\n // Restore original value\n textarea.value = currentValue;\n\n // Adjust height after calculating maxHeight\n if (currentValue) {\n textarea.style.height = \"auto\";\n textarea.style.height = `${Math.min(textarea.scrollHeight, contentHeight * maxRows + paddingTop + paddingBottom)}px`;\n }\n\n if (props.autoFocus) {\n textarea.focus();\n }\n }\n };\n\n calculateMaxHeight();\n }, [maxRows, props.autoFocus]);\n\n // Adjust height when controlled value changes\n useEffect(() => {\n adjustHeight();\n }, [props.value, maxHeight]);\n\n // Handle input events for uncontrolled usage\n const handleInput = (e: React.FormEvent<HTMLTextAreaElement>) => {\n adjustHeight();\n // Call the original onChange if provided\n if (props.onChange) {\n props.onChange(e as React.ChangeEvent<HTMLTextAreaElement>);\n }\n };\n\n return (\n <textarea\n ref={internalTextareaRef}\n {...props}\n onChange={handleInput}\n style={{\n overflow: \"auto\",\n resize: \"none\",\n maxHeight: `${maxHeight}px`,\n ...style,\n }}\n placeholder={labels.chatInputPlaceholder}\n className={twMerge(\n // Layout and sizing\n \"w-full p-5 pb-0\",\n // Behavior\n \"outline-none resize-none\",\n // Background\n \"bg-transparent\",\n // Typography\n \"antialiased font-regular leading-relaxed text-[16px]\",\n // Placeholder styles\n \"placeholder:text-[#00000077] dark:placeholder:text-[#fffc]\",\n className,\n )}\n rows={1}\n />\n );\n });\n\n export const AudioRecorder = CopilotChatAudioRecorder;\n}\n\nCopilotChatInput.TextArea.displayName = \"CopilotChatInput.TextArea\";\nCopilotChatInput.SendButton.displayName = \"CopilotChatInput.SendButton\";\nCopilotChatInput.ToolbarButton.displayName = \"CopilotChatInput.ToolbarButton\";\nCopilotChatInput.StartTranscribeButton.displayName = \"CopilotChatInput.StartTranscribeButton\";\nCopilotChatInput.CancelTranscribeButton.displayName = \"CopilotChatInput.CancelTranscribeButton\";\nCopilotChatInput.FinishTranscribeButton.displayName = \"CopilotChatInput.FinishTranscribeButton\";\nCopilotChatInput.AddFileButton.displayName = \"CopilotChatInput.AddButton\";\nCopilotChatInput.ToolsButton.displayName = \"CopilotChatInput.ToolsButton\";\nCopilotChatInput.Toolbar.displayName = \"CopilotChatInput.Toolbar\";\n\nexport default CopilotChatInput;\n","import React, { createContext, useContext, ReactNode, useMemo, useState } from \"react\";\nimport { DEFAULT_AGENT_ID, randomUUID } from \"@copilotkitnext/shared\";\n\n// Default labels\nexport const CopilotChatDefaultLabels = {\n chatInputPlaceholder: \"Type a message...\",\n chatInputToolbarStartTranscribeButtonLabel: \"Transcribe\",\n chatInputToolbarCancelTranscribeButtonLabel: \"Cancel\",\n chatInputToolbarFinishTranscribeButtonLabel: \"Finish\",\n chatInputToolbarAddButtonLabel: \"Add photos or files\",\n chatInputToolbarToolsButtonLabel: \"Tools\",\n assistantMessageToolbarCopyCodeLabel: \"Copy\",\n assistantMessageToolbarCopyCodeCopiedLabel: \"Copied\",\n assistantMessageToolbarCopyMessageLabel: \"Copy\",\n assistantMessageToolbarThumbsUpLabel: \"Good response\",\n assistantMessageToolbarThumbsDownLabel: \"Bad response\",\n assistantMessageToolbarReadAloudLabel: \"Read aloud\",\n assistantMessageToolbarRegenerateLabel: \"Regenerate\",\n userMessageToolbarCopyMessageLabel: \"Copy\",\n userMessageToolbarEditMessageLabel: \"Edit\",\n chatDisclaimerText: \"AI can make mistakes. Please verify important information.\",\n chatToggleOpenLabel: \"Open chat\",\n chatToggleCloseLabel: \"Close chat\",\n modalHeaderTitle: \"CopilotKit Chat\",\n};\n\nexport type CopilotChatLabels = typeof CopilotChatDefaultLabels;\n\n// Define the full configuration interface\nexport interface CopilotChatConfigurationValue {\n labels: CopilotChatLabels;\n agentId: string;\n threadId: string;\n isModalOpen: boolean;\n setModalOpen: (open: boolean) => void;\n isModalDefaultOpen: boolean;\n}\n\n// Create the configuration context\nconst CopilotChatConfiguration =\n createContext<CopilotChatConfigurationValue | null>(null);\n\n// Provider props interface\nexport interface CopilotChatConfigurationProviderProps {\n children: ReactNode;\n labels?: Partial<CopilotChatLabels>;\n agentId?: string;\n threadId?: string;\n isModalDefaultOpen?: boolean;\n}\n\n// Provider component\nexport const CopilotChatConfigurationProvider: React.FC<\n CopilotChatConfigurationProviderProps\n> = ({ children, labels, agentId, threadId, isModalDefaultOpen }) => {\n const parentConfig = useContext(CopilotChatConfiguration);\n\n const mergedLabels: CopilotChatLabels = useMemo(\n () => ({\n ...CopilotChatDefaultLabels,\n ...(parentConfig?.labels ?? {}),\n ...(labels ?? {}),\n }),\n [labels, parentConfig?.labels],\n );\n\n const resolvedAgentId = agentId ?? parentConfig?.agentId ?? DEFAULT_AGENT_ID;\n\n const resolvedThreadId = useMemo(() => {\n if (threadId) {\n return threadId;\n }\n if (parentConfig?.threadId) {\n return parentConfig.threadId;\n }\n return randomUUID();\n }, [threadId, parentConfig?.threadId]);\n\n const resolvedDefaultOpen = isModalDefaultOpen ?? parentConfig?.isModalDefaultOpen ?? true;\n\n const [internalModalOpen, setInternalModalOpen] = useState<boolean>(\n parentConfig?.isModalOpen ?? resolvedDefaultOpen,\n );\n\n const resolvedIsModalOpen = parentConfig?.isModalOpen ?? internalModalOpen;\n const resolvedSetModalOpen = parentConfig?.setModalOpen ?? setInternalModalOpen;\n\n const configurationValue: CopilotChatConfigurationValue = useMemo(\n () => ({\n labels: mergedLabels,\n agentId: resolvedAgentId,\n threadId: resolvedThreadId,\n isModalOpen: resolvedIsModalOpen,\n setModalOpen: resolvedSetModalOpen,\n isModalDefaultOpen: resolvedDefaultOpen,\n }),\n [\n mergedLabels,\n resolvedAgentId,\n resolvedThreadId,\n resolvedIsModalOpen,\n resolvedSetModalOpen,\n resolvedDefaultOpen,\n ],\n );\n\n return (\n <CopilotChatConfiguration.Provider value={configurationValue}>\n {children}\n </CopilotChatConfiguration.Provider>\n );\n};\n\n// Hook to use the full configuration\nexport const useCopilotChatConfiguration =\n (): CopilotChatConfigurationValue | null => {\n const configuration = useContext(CopilotChatConfiguration);\n return configuration;\n };\n","import * as React from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"@/lib/utils\";\n\nconst buttonVariants = cva(\n \"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive\",\n {\n variants: {\n variant: {\n default:\n \"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90\",\n destructive:\n \"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60\",\n outline:\n \"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50\",\n secondary:\n \"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80\",\n ghost:\n \"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50 cursor-pointer\",\n link: \"text-primary underline-offset-4 hover:underline\",\n assistantMessageToolbarButton: [\n \"cursor-pointer\",\n // Background and text\n \"p-0 text-[rgb(93,93,93)] hover:bg-[#E8E8E8]\",\n // Dark mode - lighter gray for better contrast\n \"dark:text-[rgb(243,243,243)] dark:hover:bg-[#303030]\",\n // Shape and sizing\n \"h-8 w-8\",\n // Interactions\n \"transition-colors\",\n // Hover states\n \"hover:text-[rgb(93,93,93)]\",\n \"dark:hover:text-[rgb(243,243,243)]\",\n ],\n chatInputToolbarPrimary: [\n \"cursor-pointer\",\n // Background and text\n \"bg-black text-white\",\n // Dark mode\n \"dark:bg-white dark:text-black dark:focus-visible:outline-white\",\n // Shape and sizing\n \"rounded-full\",\n // Interactions\n \"transition-colors\",\n // Focus states\n \"focus:outline-none\",\n // Hover states\n \"hover:opacity-70 disabled:hover:opacity-100\",\n // Disabled states\n \"disabled:cursor-not-allowed disabled:bg-[#00000014] disabled:text-[rgb(13,13,13)]\",\n \"dark:disabled:bg-[#454545] dark:disabled:text-white \",\n ],\n chatInputToolbarSecondary: [\n \"cursor-pointer\",\n // Background and text\n \"bg-transparent text-[#444444]\",\n // Dark mode\n \"dark:text-white dark:border-[#404040]\",\n // Shape and sizing\n \"rounded-full\",\n // Interactions\n \"transition-colors\",\n // Focus states\n \"focus:outline-none\",\n // Hover states\n \"hover:bg-[#f8f8f8] hover:text-[#333333]\",\n \"dark:hover:bg-[#404040] dark:hover:text-[#FFFFFF]\",\n // Disabled states\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n \"disabled:hover:bg-transparent disabled:hover:text-[#444444]\",\n \"dark:disabled:hover:bg-transparent dark:disabled:hover:text-[#CCCCCC]\",\n ],\n },\n size: {\n default: \"h-9 px-4 py-2 has-[>svg]:px-3\",\n sm: \"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5\",\n lg: \"h-10 rounded-md px-6 has-[>svg]:px-4\",\n icon: \"size-9\",\n chatInputToolbarIcon: [\n // Shape and sizing\n \"h-9 w-9 rounded-full\",\n ],\n chatInputToolbarIconLabel: [\n // Shape and sizing\n \"h-9 px-3 rounded-full\",\n // Layout\n \"gap-2\",\n // Typography\n \"font-normal\",\n ],\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n }\n);\n\nfunction Button({\n className,\n variant,\n size,\n asChild = false,\n ...props\n}: React.ComponentProps<\"button\"> &\n VariantProps<typeof buttonVariants> & {\n asChild?: boolean;\n }) {\n const Comp = asChild ? Slot : \"button\";\n\n return (\n <Comp\n data-slot=\"button\"\n className={cn(buttonVariants({ variant, size, className }))}\n {...props}\n />\n );\n}\n\nexport { Button, buttonVariants };\n","import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","import * as React from \"react\";\nimport * as TooltipPrimitive from \"@radix-ui/react-tooltip\";\n\nimport { cn } from \"@/lib/utils\";\n\nfunction TooltipProvider({\n delayDuration = 0,\n ...props\n}: React.ComponentProps<typeof TooltipPrimitive.Provider>) {\n return (\n <TooltipPrimitive.Provider\n data-slot=\"tooltip-provider\"\n delayDuration={delayDuration}\n {...props}\n />\n );\n}\n\nfunction Tooltip({\n ...props\n}: React.ComponentProps<typeof TooltipPrimitive.Root>) {\n return (\n <TooltipProvider>\n <TooltipPrimitive.Root data-slot=\"tooltip\" {...props} />\n </TooltipProvider>\n );\n}\n\nfunction TooltipTrigger({\n ...props\n}: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {\n return <TooltipPrimitive.Trigger data-slot=\"tooltip-trigger\" {...props} />;\n}\n\nfunction TooltipContent({\n className,\n sideOffset = 0,\n children,\n ...props\n}: React.ComponentProps<typeof TooltipPrimitive.Content>) {\n return (\n <TooltipPrimitive.Portal>\n <TooltipPrimitive.Content\n data-slot=\"tooltip-content\"\n sideOffset={sideOffset}\n className={cn(\n \"bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance\",\n className\n )}\n {...props}\n >\n {children}\n <TooltipPrimitive.Arrow className=\"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]\" />\n </TooltipPrimitive.Content>\n </TooltipPrimitive.Portal>\n );\n}\n\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };\n","\"use client\"\n\nimport * as React from \"react\"\nimport * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\"\nimport { CheckIcon, ChevronRightIcon, CircleIcon } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction DropdownMenu({\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Root>) {\n return <DropdownMenuPrimitive.Root data-slot=\"dropdown-menu\" {...props} />\n}\n\nfunction DropdownMenuPortal({\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>) {\n return (\n <DropdownMenuPrimitive.Portal data-slot=\"dropdown-menu-portal\" {...props} />\n )\n}\n\nfunction DropdownMenuTrigger({\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>) {\n return (\n <DropdownMenuPrimitive.Trigger\n data-slot=\"dropdown-menu-trigger\"\n {...props}\n />\n )\n}\n\nfunction DropdownMenuContent({\n className,\n sideOffset = 4,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Content>) {\n return (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n data-slot=\"dropdown-menu-content\"\n sideOffset={sideOffset}\n className={cn(\n \"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md\",\n className\n )}\n {...props}\n />\n </DropdownMenuPrimitive.Portal>\n )\n}\n\nfunction DropdownMenuGroup({\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Group>) {\n return (\n <DropdownMenuPrimitive.Group data-slot=\"dropdown-menu-group\" {...props} />\n )\n}\n\nfunction DropdownMenuItem({\n className,\n inset,\n variant = \"default\",\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {\n inset?: boolean\n variant?: \"default\" | \"destructive\"\n}) {\n return (\n <DropdownMenuPrimitive.Item\n data-slot=\"dropdown-menu-item\"\n data-inset={inset}\n data-variant={variant}\n className={cn(\n \"focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuCheckboxItem({\n className,\n children,\n checked,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>) {\n return (\n <DropdownMenuPrimitive.CheckboxItem\n data-slot=\"dropdown-menu-checkbox-item\"\n className={cn(\n \"focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className\n )}\n checked={checked}\n {...props}\n >\n <span className=\"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <CheckIcon className=\"size-4\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.CheckboxItem>\n )\n}\n\nfunction DropdownMenuRadioGroup({\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>) {\n return (\n <DropdownMenuPrimitive.RadioGroup\n data-slot=\"dropdown-menu-radio-group\"\n {...props}\n />\n )\n}\n\nfunction DropdownMenuRadioItem({\n className,\n children,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>) {\n return (\n <DropdownMenuPrimitive.RadioItem\n data-slot=\"dropdown-menu-radio-item\"\n className={cn(\n \"focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className\n )}\n {...props}\n >\n <span className=\"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <CircleIcon className=\"size-2 fill-current\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.RadioItem>\n )\n}\n\nfunction DropdownMenuLabel({\n className,\n inset,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {\n inset?: boolean\n}) {\n return (\n <DropdownMenuPrimitive.Label\n data-slot=\"dropdown-menu-label\"\n data-inset={inset}\n className={cn(\n \"px-2 py-1.5 text-sm font-medium data-[inset]:pl-8\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>) {\n return (\n <DropdownMenuPrimitive.Separator\n data-slot=\"dropdown-menu-separator\"\n className={cn(\"bg-border -mx-1 my-1 h-px\", className)}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuShortcut({\n className,\n ...props\n}: React.ComponentProps<\"span\">) {\n return (\n <span\n data-slot=\"dropdown-menu-shortcut\"\n className={cn(\n \"text-muted-foreground ml-auto text-xs tracking-widest\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuSub({\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>) {\n return <DropdownMenuPrimitive.Sub data-slot=\"dropdown-menu-sub\" {...props} />\n}\n\nfunction DropdownMenuSubTrigger({\n className,\n inset,\n children,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {\n inset?: boolean\n}) {\n return (\n <DropdownMenuPrimitive.SubTrigger\n data-slot=\"dropdown-menu-sub-trigger\"\n data-inset={inset}\n className={cn(\n \"focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8\",\n className\n )}\n {...props}\n >\n {children}\n <ChevronRightIcon className=\"ml-auto size-4\" />\n </DropdownMenuPrimitive.SubTrigger>\n )\n}\n\nfunction DropdownMenuSubContent({\n className,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>) {\n return (\n <DropdownMenuPrimitive.SubContent\n data-slot=\"dropdown-menu-sub-content\"\n className={cn(\n \"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n DropdownMenu,\n DropdownMenuPortal,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuLabel,\n DropdownMenuItem,\n DropdownMenuCheckboxItem,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuSub,\n DropdownMenuSubTrigger,\n DropdownMenuSubContent,\n}\n","import { useRef, useEffect, useImperativeHandle, forwardRef } from \"react\";\nimport { twMerge } from \"tailwind-merge\";\n\n/** Finite-state machine for every recorder implementation */\nexport type AudioRecorderState = \"idle\" | \"recording\" | \"processing\";\n\n/** Error subclass so callers can `instanceof`-guard recorder failures */\nexport class AudioRecorderError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"AudioRecorderError\";\n }\n}\n\nexport const CopilotChatAudioRecorder = forwardRef<\n any,\n React.HTMLAttributes<HTMLDivElement>\n>((props, ref) => {\n const { className, ...divProps } = props;\n const canvasRef = useRef<HTMLCanvasElement>(null);\n\n // Generate fake waveform that moves with time\n const getLoudness = (n: number): number[] => {\n const elapsed = Date.now() / 1000; // Use current timestamp directly\n const samples: number[] = [];\n\n for (let i = 0; i < n; i++) {\n // Create a position that moves from left to right over time\n const position = (i / n) * 10 + elapsed * 0.5; // Scroll speed (slower)\n\n // Generate waveform using multiple sine waves for realism\n const wave1 = Math.sin(position * 2) * 0.3;\n const wave2 = Math.sin(position * 5 + elapsed) * 0.2;\n const wave3 = Math.sin(position * 0.5 + elapsed * 0.3) * 0.4;\n\n // Add some randomness for natural variation\n const noise = (Math.random() - 0.5) * 0.1;\n\n // Combine waves and add envelope for realistic amplitude variation\n const envelope = Math.sin(elapsed * 0.7) * 0.5 + 0.5; // Slow amplitude modulation\n let amplitude = (wave1 + wave2 + wave3 + noise) * envelope;\n\n // Clamp to 0-1 range\n amplitude = Math.max(0, Math.min(1, amplitude * 0.5 + 0.3));\n\n samples.push(amplitude);\n }\n\n return samples;\n };\n\n // No setup needed - stub implementation\n\n // Canvas rendering with 60fps animation\n useEffect(() => {\n const canvas = canvasRef.current;\n if (!canvas) return;\n\n const ctx = canvas.getContext(\"2d\");\n if (!ctx) return;\n\n let animationId: number;\n\n const draw = () => {\n const rect = canvas.getBoundingClientRect();\n const dpr = window.devicePixelRatio || 1;\n\n // Update canvas dimensions if container resized\n if (\n canvas.width !== rect.width * dpr ||\n canvas.height !== rect.height * dpr\n ) {\n canvas.width = rect.width * dpr;\n canvas.height = rect.height * dpr;\n ctx.scale(dpr, dpr);\n ctx.imageSmoothingEnabled = false;\n }\n\n // Configuration\n const barWidth = 2;\n const minHeight = 2;\n const maxHeight = 20;\n const gap = 2;\n const numSamples = Math.ceil(rect.width / (barWidth + gap));\n\n // Get loudness data\n const loudnessData = getLoudness(numSamples);\n\n // Clear canvas\n ctx.clearRect(0, 0, rect.width, rect.height);\n\n // Get current foreground color\n const computedStyle = getComputedStyle(canvas);\n const currentForeground = computedStyle.color;\n\n // Draw bars\n ctx.fillStyle = currentForeground;\n const centerY = rect.height / 2;\n\n for (let i = 0; i < loudnessData.length; i++) {\n const sample = loudnessData[i] ?? 0;\n const barHeight = Math.round(\n sample * (maxHeight - minHeight) + minHeight\n );\n const x = Math.round(i * (barWidth + gap));\n const y = Math.round(centerY - barHeight / 2);\n\n ctx.fillRect(x, y, barWidth, barHeight);\n }\n\n animationId = requestAnimationFrame(draw);\n };\n\n draw();\n\n return () => {\n if (animationId) {\n cancelAnimationFrame(animationId);\n }\n };\n }, []);\n\n // Expose AudioRecorder API\n useImperativeHandle(\n ref,\n () => ({\n get state() {\n return \"idle\" as AudioRecorderState;\n },\n start: async () => {\n // Stub implementation - no actual recording\n },\n stop: () =>\n new Promise<Blob>((resolve) => {\n // Stub implementation - return empty blob\n const emptyBlob = new Blob([], { type: \"audio/webm\" });\n resolve(emptyBlob);\n }),\n dispose: () => {\n // No cleanup needed\n },\n }),\n []\n );\n\n return (\n <div className={twMerge(\"h-[44px] w-full px-5\", className)} {...divProps}>\n <canvas\n ref={canvasRef}\n className=\"w-full h-full\"\n style={{ imageRendering: \"pixelated\" }}\n />\n </div>\n );\n});\n\nCopilotChatAudioRecorder.displayName = \"WebAudioRecorder\";\n","import React from \"react\";\n\n// /** Utility: Create a component type with specific props omitted */\n// export type OmitSlotProps<\n// C extends React.ComponentType<any>,\n// K extends keyof React.ComponentProps<C>,\n// > = React.ComponentType<Omit<React.ComponentProps<C>, K>>;\n\n/** Existing union (unchanged) */\nexport type SlotValue<C extends React.ComponentType<any>> =\n | C\n | string\n | Partial<React.ComponentProps<C>>;\n\n/** Utility: concrete React elements for every slot */\ntype SlotElements<S> = { [K in keyof S]: React.ReactElement };\n\nexport type WithSlots<\n S extends Record<string, React.ComponentType<any>>,\n Rest = {},\n> = {\n /** Per‑slot overrides */\n [K in keyof S]?: SlotValue<S[K]>;\n} & {\n children?: (props: SlotElements<S> & Rest) => React.ReactNode;\n} & Omit<Rest, \"children\">;\n\nexport function renderSlot<\n C extends React.ComponentType<any>,\n P = React.ComponentProps<C>,\n>(\n slot: SlotValue<C> | undefined,\n DefaultComponent: C,\n props: P\n): React.ReactElement {\n if (typeof slot === \"string\") {\n return React.createElement(DefaultComponent, {\n ...(props as P),\n className: slot,\n });\n }\n if (typeof slot === \"function\") {\n const Comp = slot as C;\n return React.createElement(Comp, props as P);\n }\n\n if (slot && typeof slot === \"object\" && !React.isValidElement(slot)) {\n return React.createElement(DefaultComponent, {\n ...(props as P),\n ...slot,\n });\n }\n\n return React.createElement(DefaultComponent, props as P);\n}\n","import { AssistantMessage, Message } from \"@ag-ui/core\";\nimport { MarkdownHooks } from \"react-markdown\";\nimport remarkGfm from \"remark-gfm\";\nimport remarkMath from \"remark-math\";\nimport rehypePrettyCode from \"rehype-pretty-code\";\nimport rehypeKatex from \"rehype-katex\";\nimport { useState } from \"react\";\nimport {\n Copy,\n Check,\n ThumbsUp,\n ThumbsDown,\n Volume2,\n RefreshCw,\n} from \"lucide-react\";\nimport { cn } from \"@/lib/utils\";\nimport {\n useCopilotChatConfiguration,\n CopilotChatDefaultLabels,\n} from \"@/providers/CopilotChatConfigurationProvider\";\nimport { twMerge } from \"tailwind-merge\";\nimport { Button } from \"@/components/ui/button\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from \"@/components/ui/tooltip\";\nimport \"katex/dist/katex.min.css\";\nimport { WithSlots, renderSlot } from \"@/lib/slots\";\nimport { completePartialMarkdown } from \"@copilotkitnext/core\";\nimport CopilotChatToolCallsView from \"./CopilotChatToolCallsView\";\n\nexport type CopilotChatAssistantMessageProps = WithSlots<\n {\n markdownRenderer: typeof CopilotChatAssistantMessage.MarkdownRenderer;\n toolbar: typeof CopilotChatAssistantMessage.Toolbar;\n copyButton: typeof CopilotChatAssistantMessage.CopyButton;\n thumbsUpButton: typeof CopilotChatAssistantMessage.ThumbsUpButton;\n thumbsDownButton: typeof CopilotChatAssistantMessage.ThumbsDownButton;\n readAloudButton: typeof CopilotChatAssistantMessage.ReadAloudButton;\n regenerateButton: typeof CopilotChatAssistantMessage.RegenerateButton;\n toolCallsView: typeof CopilotChatToolCallsView;\n },\n {\n onThumbsUp?: (message: AssistantMessage) => void;\n onThumbsDown?: (message: AssistantMessage) => void;\n onReadAloud?: (message: AssistantMessage) => void;\n onRegenerate?: (message: AssistantMessage) => void;\n message: AssistantMessage;\n messages?: Message[];\n isRunning?: boolean;\n additionalToolbarItems?: React.ReactNode;\n toolbarVisible?: boolean;\n } & React.HTMLAttributes<HTMLDivElement>\n>;\n\nexport function CopilotChatAssistantMessage({\n message,\n messages,\n isRunning,\n onThumbsUp,\n onThumbsDown,\n onReadAloud,\n onRegenerate,\n additionalToolbarItems,\n toolbarVisible = true,\n markdownRenderer,\n toolbar,\n copyButton,\n thumbsUpButton,\n thumbsDownButton,\n readAloudButton,\n regenerateButton,\n toolCallsView,\n children,\n className,\n ...props\n}: CopilotChatAssistantMessageProps) {\n const boundMarkdownRenderer = renderSlot(\n markdownRenderer,\n CopilotChatAssistantMessage.MarkdownRenderer,\n {\n content: message.content || \"\",\n }\n );\n\n const boundCopyButton = renderSlot(\n copyButton,\n CopilotChatAssistantMessage.CopyButton,\n {\n onClick: async () => {\n if (message.content) {\n try {\n await navigator.clipboard.writeText(message.content);\n } catch (err) {\n console.error(\"Failed to copy message:\", err);\n }\n }\n },\n }\n );\n\n const boundThumbsUpButton = renderSlot(\n thumbsUpButton,\n CopilotChatAssistantMessage.ThumbsUpButton,\n {\n onClick: onThumbsUp,\n }\n );\n\n const boundThumbsDownButton = renderSlot(\n thumbsDownButton,\n CopilotChatAssistantMessage.ThumbsDownButton,\n {\n onClick: onThumbsDown,\n }\n );\n\n const boundReadAloudButton = renderSlot(\n readAloudButton,\n CopilotChatAssistantMessage.ReadAloudButton,\n {\n onClick: onReadAloud,\n }\n );\n\n const boundRegenerateButton = renderSlot(\n regenerateButton,\n CopilotChatAssistantMessage.RegenerateButton,\n {\n onClick: onRegenerate,\n }\n );\n\n const boundToolbar = renderSlot(\n toolbar,\n CopilotChatAssistantMessage.Toolbar,\n {\n children: (\n <div className=\"flex items-center gap-1\">\n {boundCopyButton}\n {(onThumbsUp || thumbsUpButton) && boundThumbsUpButton}\n {(onThumbsDown || thumbsDownButton) && boundThumbsDownButton}\n {(onReadAloud || readAloudButton) && boundReadAloudButton}\n {(onRegenerate || regenerateButton) && boundRegenerateButton}\n {additionalToolbarItems}\n </div>\n ),\n }\n );\n\n const boundToolCallsView = renderSlot(\n toolCallsView,\n CopilotChatToolCallsView,\n {\n message,\n messages,\n }\n );\n\n // Don't show toolbar if message has no content (only tool calls)\n const hasContent = !!(message.content && message.content.trim().length > 0);\n const shouldShowToolbar = toolbarVisible && hasContent;\n\n if (children) {\n return (\n <>\n {children({\n markdownRenderer: boundMarkdownRenderer,\n toolbar: boundToolbar,\n toolCallsView: boundToolCallsView,\n copyButton: boundCopyButton,\n thumbsUpButton: boundThumbsUpButton,\n thumbsDownButton: boundThumbsDownButton,\n readAloudButton: boundReadAloudButton,\n regenerateButton: boundRegenerateButton,\n message,\n messages,\n isRunning,\n onThumbsUp,\n onThumbsDown,\n onReadAloud,\n onRegenerate,\n additionalToolbarItems,\n toolbarVisible: shouldShowToolbar,\n })}\n </>\n );\n }\n\n return (\n <div\n className={twMerge(\n \"prose max-w-full break-words dark:prose-invert\",\n className\n )}\n {...props}\n data-message-id={message.id}\n >\n {boundMarkdownRenderer}\n {boundToolCallsView}\n {shouldShowToolbar && boundToolbar}\n </div>\n );\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace CopilotChatAssistantMessage {\n const InlineCode = ({\n children,\n ...props\n }: React.HTMLAttributes<HTMLElement>) => {\n return (\n <code\n className=\"px-[4.8px] py-[2.5px] bg-[rgb(236,236,236)] dark:bg-gray-800 rounded text-sm font-mono font-medium! text-foreground!\"\n {...props}\n >\n {children}\n </code>\n );\n };\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const CodeBlock = ({ children, className, onClick, ...props }: any) => {\n const config = useCopilotChatConfiguration();\n const labels = config?.labels ?? CopilotChatDefaultLabels;\n const [copied, setCopied] = useState(false);\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const getCodeContent = (node: any): string => {\n if (typeof node === \"string\") return node;\n if (Array.isArray(node)) return node.map(getCodeContent).join(\"\");\n if (node?.props?.children) return getCodeContent(node.props.children);\n return \"\";\n };\n\n const codeContent = getCodeContent(children);\n const language = props[\"data-language\"] as string | undefined;\n\n const copyToClipboard = async () => {\n if (!codeContent.trim()) return;\n\n try {\n setCopied(true);\n setTimeout(() => setCopied(false), 2000);\n if (onClick) {\n onClick();\n }\n } catch (err) {\n console.error(\"Failed to copy code:\", err);\n }\n };\n\n return (\n <div className=\"relative\">\n <div className=\"flex items-center justify-between px-4 pr-3 py-3 text-xs\">\n {language && (\n <span className=\"font-regular text-muted-foreground dark:text-white\">\n {language}\n </span>\n )}\n\n <button\n className={cn(\n \"px-2 gap-0.5 text-xs flex items-center cursor-pointer text-muted-foreground dark:text-white\"\n )}\n onClick={copyToClipboard}\n title={\n copied\n ? labels.assistantMessageToolbarCopyCodeCopiedLabel\n : `${labels.assistantMessageToolbarCopyCodeLabel} code`\n }\n >\n {copied ? (\n <Check className=\"h-[10px]! w-[10px]!\" />\n ) : (\n <Copy className=\"h-[10px]! w-[10px]!\" />\n )}\n <span className=\"text-[11px]\">\n {copied\n ? labels.assistantMessageToolbarCopyCodeCopiedLabel\n : labels.assistantMessageToolbarCopyCodeLabel}\n </span>\n </button>\n </div>\n\n <pre\n className={cn(\n className,\n \"rounded-2xl bg-transparent border-t-0 my-1!\"\n )}\n {...props}\n >\n {children}\n </pre>\n </div>\n );\n };\n\n export const MarkdownRenderer: React.FC<\n React.HTMLAttributes<HTMLDivElement> & { content: string }\n > = ({ content, className }) => (\n <div className={className}>\n <MarkdownHooks\n /* async plugins are now fine ✨ */\n remarkPlugins={[remarkGfm, remarkMath]}\n rehypePlugins={[\n [\n rehypePrettyCode,\n {\n keepBackground: false,\n theme: {\n dark: \"one-dark-pro\",\n light: \"one-light\",\n },\n bypassInlineCode: true,\n },\n ],\n rehypeKatex,\n ]}\n components={{\n pre: CodeBlock,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n code: ({ className, children, ...props }: any) => {\n // For inline code, use custom styling\n if (typeof children === \"string\") {\n return <InlineCode {...props}>{children}</InlineCode>;\n }\n\n // For code blocks, just return the code element as-is\n return (\n <code className={className} {...props}>\n {children}\n </code>\n );\n },\n }}\n >\n {completePartialMarkdown(content || \"\")}\n </MarkdownHooks>\n </div>\n );\n\n export const Toolbar: React.FC<React.HTMLAttributes<HTMLDivElement>> = ({\n className,\n ...props\n }) => (\n <div\n className={twMerge(\n \"w-full bg-transparent flex items-center -ml-[5px] -mt-[0px]\",\n className\n )}\n {...props}\n />\n );\n\n export const ToolbarButton: React.FC<\n React.ButtonHTMLAttributes<HTMLButtonElement> & {\n title: string;\n children: React.ReactNode;\n }\n > = ({ title, children, ...props }) => {\n return (\n <Tooltip>\n <TooltipTrigger asChild>\n <Button\n type=\"button\"\n variant=\"assistantMessageToolbarButton\"\n aria-label={title}\n {...props}\n >\n {children}\n </Button>\n </TooltipTrigger>\n <TooltipContent side=\"bottom\">\n <p>{title}</p>\n </TooltipContent>\n </Tooltip>\n );\n };\n\n export const CopyButton: React.FC<\n React.ButtonHTMLAttributes<HTMLButtonElement>\n > = ({ className, title, onClick, ...props }) => {\n const config = useCopilotChatConfiguration();\n const labels = config?.labels ?? CopilotChatDefaultLabels;\n const [copied, setCopied] = useState(false);\n\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n setCopied(true);\n setTimeout(() => setCopied(false), 2000);\n\n if (onClick) {\n onClick(event);\n }\n };\n\n return (\n <ToolbarButton\n title={title || labels.assistantMessageToolbarCopyMessageLabel}\n onClick={handleClick}\n className={className}\n {...props}\n >\n {copied ? (\n <Check className=\"size-[18px]\" />\n ) : (\n <Copy className=\"size-[18px]\" />\n )}\n </ToolbarButton>\n );\n };\n\n export const ThumbsUpButton: React.FC<\n React.ButtonHTMLAttributes<HTMLButtonElement>\n > = ({ title, ...props }) => {\n const config = useCopilotChatConfiguration();\n const labels = config?.labels ?? CopilotChatDefaultLabels;\n return (\n <ToolbarButton\n title={title || labels.assistantMessageToolbarThumbsUpLabel}\n {...props}\n >\n <ThumbsUp className=\"size-[18px]\" />\n </ToolbarButton>\n );\n };\n\n export const ThumbsDownButton: React.FC<\n React.ButtonHTMLAttributes<HTMLButtonElement>\n > = ({ title, ...props }) => {\n const config = useCopilotChatConfiguration();\n const labels = config?.labels ?? CopilotChatDefaultLabels;\n return (\n <ToolbarButton\n title={title || labels.assistantMessageToolbarThumbsDownLabel}\n {...props}\n >\n <ThumbsDown className=\"size-[18px]\" />\n </ToolbarButton>\n );\n };\n\n export const ReadAloudButton: React.FC<\n React.ButtonHTMLAttributes<HTMLButtonElement>\n > = ({ title, ...props }) => {\n const config = useCopilotChatConfiguration();\n const labels = config?.labels ?? CopilotChatDefaultLabels;\n return (\n <ToolbarButton\n title={title || labels.assistantMessageToolbarReadAloudLabel}\n {...props}\n >\n <Volume2 className=\"size-[20px]\" />\n </ToolbarButton>\n );\n };\n\n export const RegenerateButton: React.FC<\n React.ButtonHTMLAttributes<HTMLButtonElement>\n > = ({ title, ...props }) => {\n const config = useCopilotChatConfiguration();\n const labels = config?.labels ?? CopilotChatDefaultLabels;\n return (\n <ToolbarButton\n title={title || labels.assistantMessageToolbarRegenerateLabel}\n {...props}\n >\n <RefreshCw className=\"size-[18px]\" />\n </ToolbarButton>\n );\n };\n}\n\nCopilotChatAssistantMessage.MarkdownRenderer.displayName =\n \"CopilotChatAssistantMessage.MarkdownRenderer\";\nCopilotChatAssistantMessage.Toolbar.displayName =\n \"CopilotChatAssistantMessage.Toolbar\";\nCopilotChatAssistantMessage.CopyButton.displayName =\n \"CopilotChatAssistantMessage.CopyButton\";\nCopilotChatAssistantMessage.ThumbsUpButton.displayName =\n \"CopilotChatAssistantMessage.ThumbsUpButton\";\nCopilotChatAssistantMessage.ThumbsDownButton.displayName =\n \"CopilotChatAssistantMessage.ThumbsDownButton\";\nCopilotChatAssistantMessage.ReadAloudButton.displayName =\n \"CopilotChatAssistantMessage.ReadAloudButton\";\nCopilotChatAssistantMessage.RegenerateButton.displayName =\n \"CopilotChatAssistantMessage.RegenerateButton\";\n\nexport default CopilotChatAssistantMessage;\n","import React, { useCallback, useEffect, useState } from \"react\";\nimport { ToolCall, ToolMessage } from \"@ag-ui/core\";\nimport { ToolCallStatus } from \"@copilotkitnext/core\";\nimport { useCopilotKit } from \"@/providers/CopilotKitProvider\";\nimport { useCopilotChatConfiguration } from \"@/providers/CopilotChatConfigurationProvider\";\nimport { DEFAULT_AGENT_ID } from \"@copilotkitnext/shared\";\nimport { partialJSONParse } from \"@copilotkitnext/shared\";\n\nexport interface UseRenderToolCallProps {\n toolCall: ToolCall;\n toolMessage?: ToolMessage;\n}\n\n/**\n * Hook that returns a function to render tool calls based on the render functions\n * defined in CopilotKitProvider.\n *\n * @returns A function that takes a tool call and optional tool message and returns the rendered component\n */\nexport function useRenderToolCall() {\n const { currentRenderToolCalls, copilotkit } = useCopilotKit();\n const config = useCopilotChatConfiguration();\n const agentId = config?.agentId ?? DEFAULT_AGENT_ID;\n const [executingToolCallIds, setExecutingToolCallIds] = useState<\n ReadonlySet<string>\n >(() => new Set());\n\n useEffect(() => {\n const unsubscribe = copilotkit.subscribe({\n onToolExecutionStart: ({ toolCallId }) => {\n setExecutingToolCallIds((prev) => {\n if (prev.has(toolCallId)) return prev;\n const next = new Set(prev);\n next.add(toolCallId);\n return next;\n });\n },\n onToolExecutionEnd: ({ toolCallId }) => {\n setExecutingToolCallIds((prev) => {\n if (!prev.has(toolCallId)) return prev;\n const next = new Set(prev);\n next.delete(toolCallId);\n return next;\n });\n },\n });\n return () => unsubscribe();\n }, [copilotkit]);\n\n const renderToolCall = useCallback(\n ({\n toolCall,\n toolMessage,\n }: UseRenderToolCallProps): React.ReactElement | null => {\n // Find the render config for this tool call by name\n // For rendering, we show all tool calls regardless of agentId\n // The agentId scoping only affects handler execution (in core)\n // Priority order:\n // 1. Exact match by name (prefer agent-specific if multiple exist)\n // 2. Wildcard (*) renderer\n const exactMatches = currentRenderToolCalls.filter(\n (rc) => rc.name === toolCall.function.name\n );\n\n // If multiple renderers with same name exist, prefer the one matching our agentId\n const renderConfig =\n exactMatches.find((rc) => rc.agentId === agentId) ||\n exactMatches.find((rc) => !rc.agentId) ||\n exactMatches[0] ||\n currentRenderToolCalls.find((rc) => rc.name === \"*\");\n\n if (!renderConfig) {\n return null;\n }\n\n const RenderComponent = renderConfig.render;\n\n // Parse the arguments if they're a string\n const args = partialJSONParse(toolCall.function.arguments);\n\n // Create props based on status with proper typing\n const toolName = toolCall.function.name;\n\n if (toolMessage) {\n // Complete status with result\n return (\n <RenderComponent\n key={toolCall.id}\n name={toolName}\n args={args}\n status={ToolCallStatus.Complete}\n result={toolMessage.content}\n />\n );\n } else if (executingToolCallIds.has(toolCall.id)) {\n // Tool is currently executing\n return (\n <RenderComponent\n key={toolCall.id}\n name={toolName}\n // args should be complete when executing; but pass whatever we have\n args={args}\n status={ToolCallStatus.Executing}\n result={undefined}\n />\n );\n } else {\n // In progress status - tool call exists but hasn't completed yet\n // This remains true even after agent stops running, until we get a result\n return (\n <RenderComponent\n key={toolCall.id}\n name={toolName}\n args={args}\n status={ToolCallStatus.InProgress}\n result={undefined}\n />\n );\n }\n },\n [currentRenderToolCalls, executingToolCallIds, agentId]\n );\n\n return renderToolCall;\n}\n","\"use client\";\n\nimport React, { createContext, useContext, ReactNode, useMemo, useEffect, useState, useReducer, useRef } from \"react\";\nimport { ReactToolCallRender } from \"../types/react-tool-call-render\";\nimport { ReactFrontendTool } from \"../types/frontend-tool\";\nimport { ReactHumanInTheLoop } from \"../types/human-in-the-loop\";\nimport { z } from \"zod\";\nimport { CopilotKitCore, CopilotKitCoreConfig, FrontendTool } from \"@copilotkitnext/core\";\nimport { AbstractAgent } from \"@ag-ui/client\";\n\n// Define the context value interface - idiomatic React naming\nexport interface CopilotKitContextValue {\n copilotkit: CopilotKitCore;\n renderToolCalls: ReactToolCallRender<any>[];\n currentRenderToolCalls: ReactToolCallRender<unknown>[];\n setCurrentRenderToolCalls: React.Dispatch<React.SetStateAction<ReactToolCallRender<unknown>[]>>;\n}\n\n// Create the CopilotKit context\nconst CopilotKitContext = createContext<CopilotKitContextValue>({\n copilotkit: null!,\n renderToolCalls: [],\n currentRenderToolCalls: [],\n setCurrentRenderToolCalls: () => {},\n});\n\n// Provider props interface\nexport interface CopilotKitProviderProps {\n children: ReactNode;\n runtimeUrl?: string;\n headers?: Record<string, string>;\n properties?: Record<string, unknown>;\n agents__unsafe_dev_only?: Record<string, AbstractAgent>;\n renderToolCalls?: ReactToolCallRender<any>[];\n frontendTools?: ReactFrontendTool[];\n humanInTheLoop?: ReactHumanInTheLoop[];\n}\n\n// Small helper to normalize array props to a stable reference and warn\nfunction useStableArrayProp<T>(\n prop: T[] | undefined,\n warningMessage?: string,\n isMeaningfulChange?: (initial: T[], next: T[]) => boolean,\n): T[] {\n const empty = useMemo<T[]>(() => [], []);\n const value = prop ?? empty;\n const initial = useRef(value);\n\n useEffect(() => {\n if (\n warningMessage &&\n value !== initial.current &&\n (isMeaningfulChange ? isMeaningfulChange(initial.current, value) : true)\n ) {\n console.error(warningMessage);\n }\n }, [value, warningMessage]);\n\n return value;\n}\n\n// Provider component\nexport const CopilotKitProvider: React.FC<CopilotKitProviderProps> = ({\n children,\n runtimeUrl,\n headers = {},\n properties = {},\n agents__unsafe_dev_only: agents = {},\n renderToolCalls,\n frontendTools,\n humanInTheLoop,\n}) => {\n // Normalize array props to stable references with clear dev warnings\n const renderToolCallsList = useStableArrayProp<ReactToolCallRender<any>>(\n renderToolCalls,\n \"renderToolCalls must be a stable array. If you want to dynamically add or remove tools, use `useFrontendTool` instead.\",\n (initial, next) => {\n // Only warn if the shape (names+agentId) changed. Allow identity changes\n // to support updated closures from parents (e.g., Storybook state).\n const key = (rc?: ReactToolCallRender<unknown>) => `${rc?.agentId ?? \"\"}:${rc?.name ?? \"\"}`;\n const setFrom = (arr: ReactToolCallRender<unknown>[]) => new Set(arr.map(key));\n const a = setFrom(initial);\n const b = setFrom(next);\n if (a.size !== b.size) return true;\n for (const k of a) if (!b.has(k)) return true;\n return false;\n },\n );\n const frontendToolsList = useStableArrayProp<ReactFrontendTool>(\n frontendTools,\n \"frontendTools must be a stable array. If you want to dynamically add or remove tools, use `useFrontendTool` instead.\",\n );\n const humanInTheLoopList = useStableArrayProp<ReactHumanInTheLoop>(\n humanInTheLoop,\n \"humanInTheLoop must be a stable array. If you want to dynamically add or remove human-in-the-loop tools, use `useHumanInTheLoop` instead.\",\n );\n\n const initialRenderToolCalls = useMemo(() => renderToolCallsList, []);\n const [currentRenderToolCalls, setCurrentRenderToolCalls] = useState<ReactToolCallRender<unknown>[]>([]);\n\n // Note: warnings for array identity changes are handled by useStableArrayProp\n\n // Process humanInTheLoop tools to create handlers and add render components\n const processedHumanInTheLoopTools = useMemo(() => {\n const processedTools: FrontendTool[] = [];\n const processedRenderToolCalls: ReactToolCallRender<unknown>[] = [];\n\n humanInTheLoopList.forEach((tool) => {\n // Create a promise-based handler for each human-in-the-loop tool\n const frontendTool: FrontendTool = {\n name: tool.name,\n description: tool.description,\n parameters: tool.parameters,\n followUp: tool.followUp,\n ...(tool.agentId && { agentId: tool.agentId }),\n handler: async () => {\n // This handler will be replaced by the hook when it runs\n // For provider-level tools, we create a basic handler that waits for user interaction\n return new Promise((resolve) => {\n // The actual implementation will be handled by the render component\n // This is a placeholder that the hook will override\n console.warn(`Human-in-the-loop tool '${tool.name}' called but no interactive handler is set up.`);\n resolve(undefined);\n });\n },\n };\n processedTools.push(frontendTool);\n\n // Add the render component to renderToolCalls\n if (tool.render) {\n processedRenderToolCalls.push({\n name: tool.name,\n args: tool.parameters!,\n render: tool.render,\n ...(tool.agentId && { agentId: tool.agentId }),\n } as ReactToolCallRender<unknown>);\n }\n });\n\n return { tools: processedTools, renderToolCalls: processedRenderToolCalls };\n }, [humanInTheLoopList]);\n\n // Combine all tools for CopilotKitCore\n const allTools = useMemo(() => {\n const tools: FrontendTool[] = [];\n\n // Add frontend tools\n tools.push(...frontendToolsList);\n\n // Add processed human-in-the-loop tools\n tools.push(...processedHumanInTheLoopTools.tools);\n\n return tools;\n }, [frontendToolsList, processedHumanInTheLoopTools]);\n\n // Combine all render tool calls\n const allRenderToolCalls = useMemo(() => {\n const combined: ReactToolCallRender<unknown>[] = [...renderToolCallsList];\n\n // Add render components from frontend tools\n frontendToolsList.forEach((tool) => {\n if (tool.render) {\n // For wildcard tools without parameters, default to z.any()\n const args = tool.parameters || (tool.name === \"*\" ? z.any() : undefined);\n if (args) {\n combined.push({\n name: tool.name,\n args: args,\n render: tool.render,\n } as ReactToolCallRender<unknown>);\n }\n }\n });\n\n // Add render components from human-in-the-loop tools\n combined.push(...processedHumanInTheLoopTools.renderToolCalls);\n\n return combined;\n }, [renderToolCallsList, frontendToolsList, processedHumanInTheLoopTools]);\n\n const copilotkit = useMemo(() => {\n const config: CopilotKitCoreConfig = {\n runtimeUrl,\n headers,\n properties,\n agents__unsafe_dev_only: agents,\n tools: allTools,\n };\n const copilotkit = new CopilotKitCore(config);\n\n return copilotkit;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [allTools]);\n\n // Merge computed render tool calls with any dynamically registered ones.\n // Computed entries (from props) take precedence for the same name/agentId.\n useEffect(() => {\n setCurrentRenderToolCalls((prev) => {\n // Build a map from computed entries\n const keyOf = (rc?: ReactToolCallRender<unknown>) => `${rc?.agentId ?? \"\"}:${rc?.name ?? \"\"}`;\n const computedMap = new Map<string, ReactToolCallRender<unknown>>();\n for (const rc of allRenderToolCalls) {\n computedMap.set(keyOf(rc), rc);\n }\n\n // Start with computed, then add any dynamic entries not present\n const merged: ReactToolCallRender<unknown>[] = [...computedMap.values()];\n for (const rc of prev) {\n const k = keyOf(rc);\n if (!computedMap.has(k)) merged.push(rc);\n }\n\n // If equal by shallow key comparison and reference order, avoid updates\n const sameLength = merged.length === prev.length;\n if (sameLength) {\n let same = true;\n for (let i = 0; i < merged.length; i++) {\n if (merged[i] !== prev[i]) {\n same = false;\n break;\n }\n }\n if (same) return prev;\n }\n return merged;\n });\n }, [allRenderToolCalls]);\n\n useEffect(() => {\n copilotkit.setRuntimeUrl(runtimeUrl);\n copilotkit.setHeaders(headers);\n copilotkit.setProperties(properties);\n copilotkit.setAgents__unsafe_dev_only(agents);\n }, [runtimeUrl, headers, properties, agents]);\n\n return (\n <CopilotKitContext.Provider\n value={{\n copilotkit,\n renderToolCalls: allRenderToolCalls,\n currentRenderToolCalls,\n setCurrentRenderToolCalls,\n }}\n >\n {children}\n </CopilotKitContext.Provider>\n );\n};\n\n// Hook to use the CopilotKit instance - returns the full context value\nexport const useCopilotKit = (): CopilotKitContextValue => {\n const context = useContext(CopilotKitContext);\n const [, forceUpdate] = useReducer((x) => x + 1, 0);\n\n if (!context) {\n throw new Error(\"useCopilotKit must be used within CopilotKitProvider\");\n }\n useEffect(() => {\n const unsubscribe = context.copilotkit.subscribe({\n onRuntimeConnectionStatusChanged: () => {\n forceUpdate();\n },\n });\n return () => {\n unsubscribe();\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return context;\n};\n","import { useEffect } from \"react\";\nimport { useCopilotKit } from \"../providers/CopilotKitProvider\";\nimport { ReactFrontendTool } from \"../types/frontend-tool\";\nimport { ReactToolCallRender } from \"../types/react-tool-call-render\";\n\nexport function useFrontendTool<\n T extends Record<string, unknown> = Record<string, unknown>,\n>(tool: ReactFrontendTool<T>) {\n const { copilotkit, setCurrentRenderToolCalls } = useCopilotKit();\n\n useEffect(() => {\n const name = tool.name;\n\n // Always register/override the tool for this name on mount\n if (copilotkit.getTool({ toolName: name, agentId: tool.agentId })) {\n console.warn(\n `Tool '${name}' already exists for agent '${tool.agentId || 'global'}'. Overriding with latest registration.`\n );\n copilotkit.removeTool(name, tool.agentId);\n }\n copilotkit.addTool(tool);\n\n // Register/override renderer by name and agentId\n if (tool.render) {\n setCurrentRenderToolCalls((prev) => {\n // Only replace renderers with the same name AND agentId\n const replaced = prev.filter((rc) => \n !(rc.name === name && rc.agentId === tool.agentId)\n );\n return [\n ...replaced,\n {\n name,\n args: tool.parameters,\n agentId: tool.agentId,\n render: tool.render,\n } as ReactToolCallRender<unknown>,\n ];\n });\n }\n\n return () => {\n copilotkit.removeTool(name, tool.agentId);\n // we are intentionally not removing the render here so that the tools can still render in the chat history\n };\n // Depend only on stable keys to avoid re-register loops due to object identity\n }, [tool.name, copilotkit, setCurrentRenderToolCalls]);\n}\n","import { ReactToolCallRender } from \"@/types/react-tool-call-render\";\nimport { useFrontendTool } from \"./use-frontend-tool\";\nimport { ReactFrontendTool } from \"@/types/frontend-tool\";\nimport { ReactHumanInTheLoop } from \"@/types/human-in-the-loop\";\nimport { useState, useCallback, useRef, useEffect } from \"react\";\nimport React from \"react\";\nimport { useCopilotKit } from \"@/providers/CopilotKitProvider\";\n\nexport function useHumanInTheLoop<T extends Record<string, unknown> = Record<string, unknown>>(\n tool: ReactHumanInTheLoop<T>\n) {\n const [status, setStatus] = useState<\"inProgress\" | \"executing\" | \"complete\">(\n \"inProgress\"\n );\n const statusRef = useRef(status);\n const resolvePromiseRef = useRef<((result: unknown) => void) | null>(null);\n const { setCurrentRenderToolCalls } = useCopilotKit();\n\n statusRef.current = status;\n\n const respond = useCallback(async (result: unknown) => {\n if (resolvePromiseRef.current) {\n resolvePromiseRef.current(result);\n setStatus(\"complete\");\n resolvePromiseRef.current = null;\n }\n }, []);\n\n const handler = useCallback(async () => {\n return new Promise((resolve) => {\n setStatus(\"executing\");\n resolvePromiseRef.current = resolve;\n });\n }, []);\n\n const RenderComponent: ReactToolCallRender<T>[\"render\"] = useCallback(\n (props) => {\n const ToolComponent = tool.render;\n const currentStatus = statusRef.current;\n\n // Enhance props based on current status\n if (currentStatus === \"inProgress\" && props.status === \"inProgress\") {\n const enhancedProps = {\n ...props,\n name: tool.name,\n description: tool.description || \"\",\n respond: undefined,\n };\n return React.createElement(ToolComponent, enhancedProps);\n } else if (currentStatus === \"executing\" && props.status === \"executing\") {\n const enhancedProps = {\n ...props,\n name: tool.name,\n description: tool.description || \"\",\n respond,\n };\n return React.createElement(ToolComponent, enhancedProps);\n } else if (currentStatus === \"complete\" && props.status === \"complete\") {\n const enhancedProps = {\n ...props,\n name: tool.name,\n description: tool.description || \"\",\n respond: undefined,\n };\n return React.createElement(ToolComponent, enhancedProps);\n }\n\n // Fallback - just render with original props\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return React.createElement(ToolComponent, props as any);\n },\n [tool.render, tool.name, tool.description, respond]\n );\n\n const frontendTool: ReactFrontendTool<T> = {\n ...tool,\n handler,\n render: RenderComponent,\n };\n\n useFrontendTool(frontendTool);\n\n useEffect(() => {\n return () => {\n setCurrentRenderToolCalls((prev) =>\n prev.filter(\n (rc) => rc.name !== tool.name || rc.agentId !== tool.agentId\n )\n );\n };\n }, [setCurrentRenderToolCalls, tool.name, tool.agentId]);\n}\n","import { useCopilotKit } from \"@/providers/CopilotKitProvider\";\nimport { useMemo, useEffect, useReducer } from \"react\";\nimport { DEFAULT_AGENT_ID } from \"@copilotkitnext/shared\";\nimport { AbstractAgent } from \"@ag-ui/client\";\n\nexport enum UseAgentUpdate {\n OnMessagesChanged = \"OnMessagesChanged\",\n OnStateChanged = \"OnStateChanged\",\n OnRunStatusChanged = \"OnRunStatusChanged\",\n}\n\nconst ALL_UPDATES: UseAgentUpdate[] = [\n UseAgentUpdate.OnMessagesChanged,\n UseAgentUpdate.OnStateChanged,\n UseAgentUpdate.OnRunStatusChanged,\n];\n\nexport interface UseAgentProps {\n agentId?: string;\n updates?: UseAgentUpdate[];\n}\n\nexport function useAgent({ agentId, updates }: UseAgentProps = {}) {\n agentId ??= DEFAULT_AGENT_ID;\n\n const { copilotkit } = useCopilotKit();\n const [, forceUpdate] = useReducer((x) => x + 1, 0);\n\n const updateFlags = useMemo(\n () => updates ?? ALL_UPDATES,\n [JSON.stringify(updates)]\n );\n\n const agent: AbstractAgent | undefined = useMemo(() => {\n return copilotkit.getAgent(agentId);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n agentId,\n copilotkit.agents,\n copilotkit.runtimeConnectionStatus,\n copilotkit,\n ]);\n\n useEffect(() => {\n if (!agent) {\n return;\n }\n\n if (updateFlags.length === 0) {\n return;\n }\n\n const handlers: Parameters<AbstractAgent[\"subscribe\"]>[0] = {};\n\n if (updateFlags.includes(UseAgentUpdate.OnMessagesChanged)) {\n handlers.onMessagesChanged = () => {\n forceUpdate();\n };\n }\n\n if (updateFlags.includes(UseAgentUpdate.OnStateChanged)) {\n handlers.onStateChanged = () => {\n forceUpdate();\n };\n }\n\n if (updateFlags.includes(UseAgentUpdate.OnRunStatusChanged)) {\n handlers.onRunInitialized = () => {\n forceUpdate();\n };\n handlers.onRunFinalized = () => {\n forceUpdate();\n };\n handlers.onRunFailed = () => {\n forceUpdate();\n };\n }\n\n const subscription = agent.subscribe(handlers);\n return () => subscription.unsubscribe();\n }, [agent, forceUpdate, JSON.stringify(updateFlags)]);\n\n return {\n agent,\n };\n}\n","import { useCopilotKit } from \"../providers/CopilotKitProvider\";\nimport { Context } from \"@ag-ui/client\";\nimport { useEffect } from \"react\";\n\nexport function useAgentContext(context: Context) {\n const { description, value } = context;\n const { copilotkit } = useCopilotKit();\n\n useEffect(() => {\n if (!copilotkit) return;\n\n const id = copilotkit.addContext(context);\n return () => {\n copilotkit.removeContext(id);\n };\n }, [description, value, copilotkit]);\n}\n","import { useCallback, useEffect, useMemo, useState } from \"react\";\nimport { Suggestion } from \"@copilotkitnext/core\";\nimport { useCopilotKit } from \"@/providers/CopilotKitProvider\";\nimport { useCopilotChatConfiguration } from \"@/providers/CopilotChatConfigurationProvider\";\nimport { DEFAULT_AGENT_ID } from \"@copilotkitnext/shared\";\n\nexport interface UseSuggestionsOptions {\n agentId?: string;\n}\n\nexport interface UseSuggestionsResult {\n suggestions: Suggestion[];\n reloadSuggestions: () => void;\n clearSuggestions: () => void;\n isLoading: boolean;\n}\n\nexport function useSuggestions({ agentId }: UseSuggestionsOptions = {}): UseSuggestionsResult {\n const { copilotkit } = useCopilotKit();\n const config = useCopilotChatConfiguration();\n const resolvedAgentId = useMemo(() => agentId ?? config?.agentId ?? DEFAULT_AGENT_ID, [agentId, config?.agentId]);\n\n const [suggestions, setSuggestions] = useState<Suggestion[]>(() => {\n const result = copilotkit.getSuggestions(resolvedAgentId);\n return result.suggestions;\n });\n const [isLoading, setIsLoading] = useState(() => {\n const result = copilotkit.getSuggestions(resolvedAgentId);\n return result.isLoading;\n });\n\n useEffect(() => {\n const result = copilotkit.getSuggestions(resolvedAgentId);\n setSuggestions(result.suggestions);\n setIsLoading(result.isLoading);\n }, [copilotkit, resolvedAgentId]);\n\n useEffect(() => {\n const unsubscribe = copilotkit.subscribe({\n onSuggestionsChanged: ({ agentId: changedAgentId, suggestions }) => {\n if (changedAgentId !== resolvedAgentId) {\n return;\n }\n setSuggestions(suggestions);\n },\n onSuggestionsStartedLoading: ({ agentId: changedAgentId }) => {\n if (changedAgentId !== resolvedAgentId) {\n return;\n }\n setIsLoading(true);\n },\n onSuggestionsFinishedLoading: ({ agentId: changedAgentId }) => {\n if (changedAgentId !== resolvedAgentId) {\n return;\n }\n setIsLoading(false);\n },\n onSuggestionsConfigChanged: () => {\n const result = copilotkit.getSuggestions(resolvedAgentId);\n setSuggestions(result.suggestions);\n setIsLoading(result.isLoading);\n },\n });\n\n return () => {\n unsubscribe();\n };\n }, [copilotkit, resolvedAgentId]);\n\n const reloadSuggestions = useCallback(() => {\n copilotkit.reloadSuggestions(resolvedAgentId);\n // Loading state is handled by onSuggestionsStartedLoading event\n }, [copilotkit, resolvedAgentId]);\n\n const clearSuggestions = useCallback(() => {\n copilotkit.clearSuggestions(resolvedAgentId);\n // State updates are handled by onSuggestionsChanged event\n }, [copilotkit, resolvedAgentId]);\n\n return {\n suggestions,\n reloadSuggestions,\n clearSuggestions,\n isLoading,\n };\n}\n","import { useCallback, useEffect, useMemo, useRef } from \"react\";\nimport { useCopilotKit } from \"@/providers/CopilotKitProvider\";\nimport { useCopilotChatConfiguration } from \"@/providers/CopilotChatConfigurationProvider\";\nimport { DEFAULT_AGENT_ID } from \"@copilotkitnext/shared\";\nimport {\n DynamicSuggestionsConfig,\n StaticSuggestionsConfig,\n SuggestionsConfig,\n Suggestion,\n} from \"@copilotkitnext/core\";\n\ntype StaticSuggestionInput = Omit<Suggestion, \"isLoading\"> & Partial<Pick<Suggestion, \"isLoading\">>;\n\ntype StaticSuggestionsConfigInput = Omit<StaticSuggestionsConfig, \"suggestions\"> & {\n suggestions: StaticSuggestionInput[];\n};\n\ntype SuggestionsConfigInput = DynamicSuggestionsConfig | StaticSuggestionsConfigInput;\n\nconst EMPTY_DEPS: ReadonlyArray<unknown> = [];\n\nexport interface UseConfigureSuggestionsOptions {\n deps?: ReadonlyArray<unknown>;\n}\n\nexport function useConfigureSuggestions(\n config: SuggestionsConfigInput | null | undefined,\n options?: UseConfigureSuggestionsOptions,\n): void {\n const { copilotkit } = useCopilotKit();\n const chatConfig = useCopilotChatConfiguration();\n const extraDeps = options?.deps ?? EMPTY_DEPS;\n\n const resolvedConsumerAgentId = useMemo(() => chatConfig?.agentId ?? DEFAULT_AGENT_ID, [chatConfig?.agentId]);\n\n const rawConsumerAgentId = useMemo(() => (config ? (config as SuggestionsConfigInput).consumerAgentId : undefined), [config]);\n\n const normalizationCacheRef = useRef<{ serialized: string | null; config: SuggestionsConfig | null }>({\n serialized: null,\n config: null,\n });\n\n const { normalizedConfig, serializedConfig } = useMemo(() => {\n if (!config) {\n normalizationCacheRef.current = { serialized: null, config: null };\n return { normalizedConfig: null, serializedConfig: null };\n }\n\n if (config.available === \"disabled\") {\n normalizationCacheRef.current = { serialized: null, config: null };\n return { normalizedConfig: null, serializedConfig: null };\n }\n\n let built: SuggestionsConfig;\n if (isDynamicConfig(config)) {\n built = {\n ...config,\n } satisfies DynamicSuggestionsConfig;\n } else {\n const normalizedSuggestions = normalizeStaticSuggestions(config.suggestions);\n const baseConfig: StaticSuggestionsConfig = {\n ...config,\n suggestions: normalizedSuggestions,\n };\n built = baseConfig;\n }\n\n const serialized = JSON.stringify(built);\n const cache = normalizationCacheRef.current;\n if (cache.serialized === serialized && cache.config) {\n return { normalizedConfig: cache.config, serializedConfig: serialized };\n }\n\n normalizationCacheRef.current = { serialized, config: built };\n return { normalizedConfig: built, serializedConfig: serialized };\n }, [config, resolvedConsumerAgentId, ...extraDeps]);\n const latestConfigRef = useRef<SuggestionsConfig | null>(null);\n latestConfigRef.current = normalizedConfig;\n const previousSerializedConfigRef = useRef<string | null>(null);\n\n const targetAgentId = useMemo(() => {\n if (!normalizedConfig) {\n return resolvedConsumerAgentId;\n }\n const consumer = (normalizedConfig as StaticSuggestionsConfig | DynamicSuggestionsConfig).consumerAgentId;\n if (!consumer || consumer === \"*\") {\n return resolvedConsumerAgentId;\n }\n return consumer;\n }, [normalizedConfig, resolvedConsumerAgentId]);\n\n const isGlobalConfig = rawConsumerAgentId === undefined || rawConsumerAgentId === \"*\";\n\n const requestReload = useCallback(() => {\n if (!normalizedConfig) {\n return;\n }\n\n if (isGlobalConfig) {\n const agents = Object.values(copilotkit.agents ?? {});\n for (const entry of agents) {\n const agentId = entry.agentId;\n if (!agentId) {\n continue;\n }\n if (!entry.isRunning) {\n copilotkit.reloadSuggestions(agentId);\n }\n }\n return;\n }\n\n if (!targetAgentId) {\n return;\n }\n\n copilotkit.reloadSuggestions(targetAgentId);\n }, [copilotkit, isGlobalConfig, normalizedConfig, targetAgentId]);\n\n useEffect(() => {\n if (!serializedConfig || !latestConfigRef.current) {\n return;\n }\n\n const id = copilotkit.addSuggestionsConfig(latestConfigRef.current);\n\n requestReload();\n\n return () => {\n copilotkit.removeSuggestionsConfig(id);\n };\n }, [copilotkit, serializedConfig, requestReload]);\n\n useEffect(() => {\n if (!normalizedConfig) {\n previousSerializedConfigRef.current = null;\n return;\n }\n if (serializedConfig && previousSerializedConfigRef.current === serializedConfig) {\n return;\n }\n if (serializedConfig) {\n previousSerializedConfigRef.current = serializedConfig;\n }\n requestReload();\n }, [normalizedConfig, requestReload, serializedConfig]);\n\n useEffect(() => {\n if (!normalizedConfig || extraDeps.length === 0) {\n return;\n }\n requestReload();\n }, [extraDeps.length, normalizedConfig, requestReload, ...extraDeps]);\n\n}\n\nfunction isDynamicConfig(config: SuggestionsConfigInput): config is DynamicSuggestionsConfig {\n return \"instructions\" in config;\n}\n\nfunction normalizeStaticSuggestions(suggestions: StaticSuggestionInput[]): Suggestion[] {\n return suggestions.map((suggestion) => ({\n ...suggestion,\n isLoading: suggestion.isLoading ?? false,\n }));\n}\n","import { useRenderToolCall } from \"@/hooks\";\nimport { AssistantMessage, Message, ToolMessage } from \"@ag-ui/core\";\nimport React from \"react\";\n\nexport type CopilotChatToolCallsViewProps = {\n message: AssistantMessage;\n messages?: Message[];\n};\n\nexport function CopilotChatToolCallsView({\n message,\n messages = [],\n}: CopilotChatToolCallsViewProps) {\n const renderToolCall = useRenderToolCall();\n\n if (!message.toolCalls || message.toolCalls.length === 0) {\n return null;\n }\n\n return (\n <>\n {message.toolCalls.map((toolCall) => {\n const toolMessage = messages.find(\n (m) => m.role === \"tool\" && m.toolCallId === toolCall.id\n ) as ToolMessage | undefined;\n\n return (\n <React.Fragment key={toolCall.id}>\n {renderToolCall({\n toolCall,\n toolMessage,\n })}\n </React.Fragment>\n );\n })}\n </>\n );\n}\n\nexport default CopilotChatToolCallsView;\n","import { useState } from \"react\";\nimport { Copy, Check, Edit, ChevronLeft, ChevronRight } from \"lucide-react\";\nimport {\n useCopilotChatConfiguration,\n CopilotChatDefaultLabels,\n} from \"@/providers/CopilotChatConfigurationProvider\";\nimport { twMerge } from \"tailwind-merge\";\nimport { Button } from \"@/components/ui/button\";\nimport { UserMessage } from \"@ag-ui/core\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from \"@/components/ui/tooltip\";\nimport { renderSlot, WithSlots } from \"@/lib/slots\";\n\nexport interface CopilotChatUserMessageOnEditMessageProps {\n message: UserMessage;\n}\n\nexport interface CopilotChatUserMessageOnSwitchToBranchProps {\n message: UserMessage;\n branchIndex: number;\n numberOfBranches: number;\n}\n\nexport type CopilotChatUserMessageProps = WithSlots<\n {\n messageRenderer: typeof CopilotChatUserMessage.MessageRenderer;\n toolbar: typeof CopilotChatUserMessage.Toolbar;\n copyButton: typeof CopilotChatUserMessage.CopyButton;\n editButton: typeof CopilotChatUserMessage.EditButton;\n branchNavigation: typeof CopilotChatUserMessage.BranchNavigation;\n },\n {\n onEditMessage?: (props: CopilotChatUserMessageOnEditMessageProps) => void;\n onSwitchToBranch?: (\n props: CopilotChatUserMessageOnSwitchToBranchProps\n ) => void;\n message: UserMessage;\n branchIndex?: number;\n numberOfBranches?: number;\n additionalToolbarItems?: React.ReactNode;\n } & React.HTMLAttributes<HTMLDivElement>\n>;\n\nexport function CopilotChatUserMessage({\n message,\n onEditMessage,\n branchIndex,\n numberOfBranches,\n onSwitchToBranch,\n additionalToolbarItems,\n messageRenderer,\n toolbar,\n copyButton,\n editButton,\n branchNavigation,\n children,\n className,\n ...props\n}: CopilotChatUserMessageProps) {\n const BoundMessageRenderer = renderSlot(\n messageRenderer,\n CopilotChatUserMessage.MessageRenderer,\n {\n content: message.content || \"\",\n }\n );\n\n const BoundCopyButton = renderSlot(\n copyButton,\n CopilotChatUserMessage.CopyButton,\n {\n onClick: async () => {\n if (message.content) {\n try {\n await navigator.clipboard.writeText(message.content);\n } catch (err) {\n console.error(\"Failed to copy message:\", err);\n }\n }\n },\n }\n );\n\n const BoundEditButton = renderSlot(\n editButton,\n CopilotChatUserMessage.EditButton,\n {\n onClick: () => onEditMessage?.({ message }),\n }\n );\n\n const BoundBranchNavigation = renderSlot(\n branchNavigation,\n CopilotChatUserMessage.BranchNavigation,\n {\n currentBranch: branchIndex,\n numberOfBranches,\n onSwitchToBranch,\n message,\n }\n );\n\n const showBranchNavigation =\n numberOfBranches && numberOfBranches > 1 && onSwitchToBranch;\n\n const BoundToolbar = renderSlot(toolbar, CopilotChatUserMessage.Toolbar, {\n children: (\n <div className=\"flex items-center gap-1 justify-end\">\n {additionalToolbarItems}\n {BoundCopyButton}\n {onEditMessage && BoundEditButton}\n {showBranchNavigation && BoundBranchNavigation}\n </div>\n ),\n });\n\n if (children) {\n return (\n <>\n {children({\n messageRenderer: BoundMessageRenderer,\n toolbar: BoundToolbar,\n copyButton: BoundCopyButton,\n editButton: BoundEditButton,\n branchNavigation: BoundBranchNavigation,\n message,\n branchIndex,\n numberOfBranches,\n additionalToolbarItems,\n })}\n </>\n );\n }\n\n return (\n <div\n className={twMerge(\"flex flex-col items-end group pt-10\", className)}\n data-message-id={message.id}\n {...props}\n >\n {BoundMessageRenderer}\n {BoundToolbar}\n </div>\n );\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace CopilotChatUserMessage {\n export const Container: React.FC<\n React.PropsWithChildren<React.HTMLAttributes<HTMLDivElement>>\n > = ({ children, className, ...props }) => (\n <div\n className={twMerge(\"flex flex-col items-end group\", className)}\n {...props}\n >\n {children}\n </div>\n );\n\n export const MessageRenderer: React.FC<{\n content: string;\n className?: string;\n }> = ({ content, className }) => (\n <div\n className={twMerge(\n \"prose dark:prose-invert bg-muted relative max-w-[80%] rounded-[18px] px-4 py-1.5 data-[multiline]:py-3 inline-block whitespace-pre-wrap\",\n className\n )}\n >\n {content}\n </div>\n );\n\n export const Toolbar: React.FC<React.HTMLAttributes<HTMLDivElement>> = ({\n className,\n ...props\n }) => (\n <div\n className={twMerge(\n \"w-full bg-transparent flex items-center justify-end -mr-[5px] mt-[4px] invisible group-hover:visible\",\n className\n )}\n {...props}\n />\n );\n\n export const ToolbarButton: React.FC<\n React.ButtonHTMLAttributes<HTMLButtonElement> & {\n title: string;\n children: React.ReactNode;\n }\n > = ({ title, children, className, ...props }) => {\n return (\n <Tooltip>\n <TooltipTrigger asChild>\n <Button\n type=\"button\"\n variant=\"assistantMessageToolbarButton\"\n aria-label={title}\n className={twMerge(className)}\n {...props}\n >\n {children}\n </Button>\n </TooltipTrigger>\n <TooltipContent side=\"bottom\">\n <p>{title}</p>\n </TooltipContent>\n </Tooltip>\n );\n };\n\n export const CopyButton: React.FC<\n React.ButtonHTMLAttributes<HTMLButtonElement> & { copied?: boolean }\n > = ({ className, title, onClick, ...props }) => {\n const config = useCopilotChatConfiguration();\n const labels = config?.labels ?? CopilotChatDefaultLabels;\n const [copied, setCopied] = useState(false);\n\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n setCopied(true);\n setTimeout(() => setCopied(false), 2000);\n\n if (onClick) {\n onClick(event);\n }\n };\n\n return (\n <ToolbarButton\n title={title || labels.userMessageToolbarCopyMessageLabel}\n onClick={handleClick}\n className={className}\n {...props}\n >\n {copied ? (\n <Check className=\"size-[18px]\" />\n ) : (\n <Copy className=\"size-[18px]\" />\n )}\n </ToolbarButton>\n );\n };\n\n export const EditButton: React.FC<\n React.ButtonHTMLAttributes<HTMLButtonElement>\n > = ({ className, title, ...props }) => {\n const config = useCopilotChatConfiguration();\n const labels = config?.labels ?? CopilotChatDefaultLabels;\n return (\n <ToolbarButton\n title={title || labels.userMessageToolbarEditMessageLabel}\n className={className}\n {...props}\n >\n <Edit className=\"size-[18px]\" />\n </ToolbarButton>\n );\n };\n\n export const BranchNavigation: React.FC<\n React.HTMLAttributes<HTMLDivElement> & {\n currentBranch?: number;\n numberOfBranches?: number;\n onSwitchToBranch?: (\n props: CopilotChatUserMessageOnSwitchToBranchProps\n ) => void;\n message: UserMessage;\n }\n > = ({\n className,\n currentBranch = 0,\n numberOfBranches = 1,\n onSwitchToBranch,\n message,\n ...props\n }) => {\n if (!numberOfBranches || numberOfBranches <= 1 || !onSwitchToBranch) {\n return null;\n }\n\n const canGoPrev = currentBranch > 0;\n const canGoNext = currentBranch < numberOfBranches - 1;\n\n return (\n <div className={twMerge(\"flex items-center gap-1\", className)} {...props}>\n <Button\n type=\"button\"\n variant=\"assistantMessageToolbarButton\"\n onClick={() =>\n onSwitchToBranch?.({\n branchIndex: currentBranch - 1,\n numberOfBranches,\n message,\n })\n }\n disabled={!canGoPrev}\n className=\"h-6 w-6 p-0\"\n >\n <ChevronLeft className=\"size-[20px]\" />\n </Button>\n <span className=\"text-sm text-muted-foreground px-0 font-medium\">\n {currentBranch + 1}/{numberOfBranches}\n </span>\n <Button\n type=\"button\"\n variant=\"assistantMessageToolbarButton\"\n onClick={() =>\n onSwitchToBranch?.({\n branchIndex: currentBranch + 1,\n numberOfBranches,\n message,\n })\n }\n disabled={!canGoNext}\n className=\"h-6 w-6 p-0\"\n >\n <ChevronRight className=\"size-[20px]\" />\n </Button>\n </div>\n );\n };\n}\n\nCopilotChatUserMessage.Container.displayName =\n \"CopilotChatUserMessage.Container\";\nCopilotChatUserMessage.MessageRenderer.displayName =\n \"CopilotChatUserMessage.MessageRenderer\";\nCopilotChatUserMessage.Toolbar.displayName = \"CopilotChatUserMessage.Toolbar\";\nCopilotChatUserMessage.ToolbarButton.displayName =\n \"CopilotChatUserMessage.ToolbarButton\";\nCopilotChatUserMessage.CopyButton.displayName =\n \"CopilotChatUserMessage.CopyButton\";\nCopilotChatUserMessage.EditButton.displayName =\n \"CopilotChatUserMessage.EditButton\";\nCopilotChatUserMessage.BranchNavigation.displayName =\n \"CopilotChatUserMessage.BranchNavigation\";\n\nexport default CopilotChatUserMessage;\n","import React from \"react\";\nimport { Loader2 } from \"lucide-react\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface CopilotChatSuggestionPillProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /** Optional icon to render on the left side when not loading. */\n icon?: React.ReactNode;\n /** Whether the pill should display a loading spinner. */\n isLoading?: boolean;\n}\n\nconst baseClasses =\n \"group inline-flex h-8 items-center gap-1.5 rounded-full border border-border/60 bg-background px-3 text-xs leading-none text-foreground transition-colors cursor-pointer hover:bg-accent/60 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:text-muted-foreground disabled:hover:bg-background disabled:hover:text-muted-foreground pointer-events-auto\";\n\nconst labelClasses = \"whitespace-nowrap font-medium leading-none\";\n\nexport const CopilotChatSuggestionPill = React.forwardRef<\n HTMLButtonElement,\n CopilotChatSuggestionPillProps\n>(function CopilotChatSuggestionPill(\n { className, children, icon, isLoading, type, ...props },\n ref\n) {\n const showIcon = !isLoading && icon;\n\n return (\n <button\n ref={ref}\n data-slot=\"suggestion-pill\"\n className={cn(baseClasses, className)}\n type={type ?? \"button\"}\n aria-busy={isLoading || undefined}\n disabled={isLoading || props.disabled}\n {...props}\n >\n {isLoading ? (\n <span className=\"flex h-4 w-4 items-center justify-center text-muted-foreground\">\n <Loader2 className=\"h-4 w-4 animate-spin\" aria-hidden=\"true\" />\n </span>\n ) : (\n showIcon && (\n <span className=\"flex h-4 w-4 items-center justify-center text-muted-foreground\">{icon}</span>\n )\n )}\n <span className={labelClasses}>{children}</span>\n </button>\n );\n});\n\nCopilotChatSuggestionPill.displayName = \"CopilotChatSuggestionPill\";\n\nexport default CopilotChatSuggestionPill;\n","import React from \"react\";\nimport { Suggestion } from \"@copilotkitnext/core\";\nimport { renderSlot, WithSlots } from \"@/lib/slots\";\nimport { cn } from \"@/lib/utils\";\nimport CopilotChatSuggestionPill, {\n CopilotChatSuggestionPillProps,\n} from \"./CopilotChatSuggestionPill\";\n\nconst DefaultContainer = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(function DefaultContainer({ className, ...props }, ref) {\n return (\n <div\n ref={ref}\n className={cn(\n \"flex flex-wrap items-center gap-2 px-4 sm:px-0 pointer-events-none\",\n className,\n )}\n {...props}\n />\n );\n});\n\nexport type CopilotChatSuggestionViewProps = WithSlots<\n {\n container: typeof DefaultContainer;\n suggestion: typeof CopilotChatSuggestionPill;\n },\n {\n suggestions: Suggestion[];\n onSelectSuggestion?: (suggestion: Suggestion, index: number) => void;\n loadingIndexes?: ReadonlyArray<number>;\n } & React.HTMLAttributes<HTMLDivElement>\n>;\n\nexport const CopilotChatSuggestionView = React.forwardRef<\n HTMLDivElement,\n CopilotChatSuggestionViewProps\n>(function CopilotChatSuggestionView(\n {\n suggestions,\n onSelectSuggestion,\n loadingIndexes,\n container,\n suggestion: suggestionSlot,\n className,\n children,\n ...restProps\n },\n ref,\n) {\n const loadingSet = React.useMemo(() => {\n if (!loadingIndexes || loadingIndexes.length === 0) {\n return new Set<number>();\n }\n return new Set(loadingIndexes);\n }, [loadingIndexes]);\n\n const ContainerElement = renderSlot(container, DefaultContainer, {\n ref,\n className,\n ...restProps,\n });\n\n const suggestionElements = suggestions.map((suggestion, index) => {\n const isLoading = loadingSet.has(index) || suggestion.isLoading === true;\n const pill = renderSlot<\n typeof CopilotChatSuggestionPill,\n CopilotChatSuggestionPillProps\n >(suggestionSlot, CopilotChatSuggestionPill, {\n children: suggestion.title,\n isLoading,\n type: \"button\",\n onClick: () => onSelectSuggestion?.(suggestion, index),\n });\n\n return React.cloneElement(pill, {\n key: `${suggestion.title}-${index}`,\n });\n });\n\n const boundContainer = React.cloneElement(\n ContainerElement,\n undefined,\n suggestionElements,\n );\n\n if (typeof children === \"function\") {\n const sampleSuggestion = renderSlot<\n typeof CopilotChatSuggestionPill,\n CopilotChatSuggestionPillProps\n >(suggestionSlot, CopilotChatSuggestionPill, {\n children: suggestions[0]?.title ?? \"\",\n isLoading:\n suggestions.length > 0 ? loadingSet.has(0) || suggestions[0]?.isLoading === true : false,\n type: \"button\",\n });\n\n return (\n <>\n {children({\n container: boundContainer,\n suggestion: sampleSuggestion,\n suggestions,\n onSelectSuggestion,\n loadingIndexes,\n className,\n ...restProps,\n })}\n </>\n );\n }\n\n if (children) {\n return (\n <>\n {boundContainer}\n {children}\n </>\n );\n }\n\n return boundContainer;\n});\n\nCopilotChatSuggestionView.displayName = \"CopilotChatSuggestionView\";\n\nexport default CopilotChatSuggestionView;\n","import { WithSlots, renderSlot } from \"@/lib/slots\";\nimport CopilotChatAssistantMessage from \"./CopilotChatAssistantMessage\";\nimport CopilotChatUserMessage from \"./CopilotChatUserMessage\";\nimport { Message } from \"@ag-ui/core\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport type CopilotChatMessageViewProps = Omit<\n WithSlots<\n {\n assistantMessage: typeof CopilotChatAssistantMessage;\n userMessage: typeof CopilotChatUserMessage;\n cursor: typeof CopilotChatMessageView.Cursor;\n },\n {\n isRunning?: boolean;\n messages?: Message[];\n } & React.HTMLAttributes<HTMLDivElement>\n >,\n \"children\"\n> & {\n children?: (props: {\n isRunning: boolean;\n messages: Message[];\n messageElements: React.ReactElement[];\n }) => React.ReactElement;\n};\n\nexport function CopilotChatMessageView({\n messages = [],\n assistantMessage,\n userMessage,\n cursor,\n isRunning = false,\n children,\n className,\n ...props\n}: CopilotChatMessageViewProps) {\n const messageElements: React.ReactElement[] = messages\n .map((message) => {\n if (message.role === \"assistant\") {\n return renderSlot(assistantMessage, CopilotChatAssistantMessage, {\n key: message.id,\n message,\n messages,\n isRunning,\n });\n } else if (message.role === \"user\") {\n return renderSlot(userMessage, CopilotChatUserMessage, {\n key: message.id,\n message,\n });\n }\n\n return;\n })\n .filter(Boolean) as React.ReactElement[];\n\n if (children) {\n return children({ messageElements, messages, isRunning });\n }\n\n return (\n <div className={twMerge(\"flex flex-col\", className)} {...props}>\n {messageElements}\n {isRunning && renderSlot(cursor, CopilotChatMessageView.Cursor, {})}\n </div>\n );\n}\n\nCopilotChatMessageView.Cursor = function Cursor({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) {\n return (\n <div\n className={twMerge(\n \"w-[11px] h-[11px] rounded-full bg-foreground animate-pulse-cursor ml-1\",\n className\n )}\n {...props}\n />\n );\n};\n\nexport default CopilotChatMessageView;\n","import React, { useRef, useState, useEffect } from \"react\";\nimport { WithSlots, renderSlot } from \"@/lib/slots\";\nimport CopilotChatMessageView from \"./CopilotChatMessageView\";\nimport CopilotChatInput, { CopilotChatInputProps } from \"./CopilotChatInput\";\nimport CopilotChatSuggestionView, { CopilotChatSuggestionViewProps } from \"./CopilotChatSuggestionView\";\nimport { Suggestion } from \"@copilotkitnext/core\";\nimport { Message } from \"@ag-ui/core\";\nimport { twMerge } from \"tailwind-merge\";\nimport { StickToBottom, useStickToBottom, useStickToBottomContext } from \"use-stick-to-bottom\";\nimport { ChevronDown } from \"lucide-react\";\nimport { Button } from \"@/components/ui/button\";\nimport { cn } from \"@/lib/utils\";\nimport { useCopilotChatConfiguration, CopilotChatDefaultLabels } from \"@/providers/CopilotChatConfigurationProvider\";\n\nexport type CopilotChatViewProps = WithSlots<\n {\n messageView: typeof CopilotChatMessageView;\n scrollView: React.FC<React.HTMLAttributes<HTMLDivElement>>;\n scrollToBottomButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement>>;\n input: typeof CopilotChatInput;\n inputContainer: React.FC<React.HTMLAttributes<HTMLDivElement> & { children: React.ReactNode }>;\n feather: React.FC<React.HTMLAttributes<HTMLDivElement>>;\n disclaimer: React.FC<React.HTMLAttributes<HTMLDivElement>>;\n suggestionView: typeof CopilotChatSuggestionView;\n },\n {\n messages?: Message[];\n autoScroll?: boolean;\n inputProps?: Partial<Omit<CopilotChatInputProps, \"children\">>;\n isRunning?: boolean;\n suggestions?: Suggestion[];\n suggestionLoadingIndexes?: ReadonlyArray<number>;\n onSelectSuggestion?: (suggestion: Suggestion, index: number) => void;\n } & React.HTMLAttributes<HTMLDivElement>\n>;\n\nexport function CopilotChatView({\n messageView,\n input,\n scrollView,\n scrollToBottomButton,\n feather,\n inputContainer,\n disclaimer,\n suggestionView,\n messages = [],\n autoScroll = true,\n inputProps,\n isRunning = false,\n suggestions,\n suggestionLoadingIndexes,\n onSelectSuggestion,\n children,\n className,\n ...props\n}: CopilotChatViewProps) {\n const inputContainerRef = useRef<HTMLDivElement>(null);\n const [inputContainerHeight, setInputContainerHeight] = useState(0);\n const [isResizing, setIsResizing] = useState(false);\n const resizeTimeoutRef = useRef<NodeJS.Timeout | null>(null);\n\n // Track input container height changes\n useEffect(() => {\n const element = inputContainerRef.current;\n if (!element) return;\n\n const resizeObserver = new ResizeObserver((entries) => {\n for (const entry of entries) {\n const newHeight = entry.contentRect.height;\n\n // Update height and set resizing state\n setInputContainerHeight((prevHeight) => {\n if (newHeight !== prevHeight) {\n setIsResizing(true);\n\n // Clear existing timeout\n if (resizeTimeoutRef.current) {\n clearTimeout(resizeTimeoutRef.current);\n }\n\n // Set isResizing to false after a short delay\n resizeTimeoutRef.current = setTimeout(() => {\n setIsResizing(false);\n }, 250);\n\n return newHeight;\n }\n return prevHeight;\n });\n }\n });\n\n resizeObserver.observe(element);\n\n // Set initial height\n setInputContainerHeight(element.offsetHeight);\n\n return () => {\n resizeObserver.disconnect();\n if (resizeTimeoutRef.current) {\n clearTimeout(resizeTimeoutRef.current);\n }\n };\n }, []);\n\n const BoundMessageView = renderSlot(messageView, CopilotChatMessageView, {\n messages,\n isRunning,\n });\n\n const BoundInput = renderSlot(input, CopilotChatInput, (inputProps ?? {}) as CopilotChatInputProps);\n const hasSuggestions = Array.isArray(suggestions) && suggestions.length > 0;\n const BoundSuggestionView = hasSuggestions\n ? renderSlot<typeof CopilotChatSuggestionView, CopilotChatSuggestionViewProps>(\n suggestionView,\n CopilotChatSuggestionView,\n {\n suggestions,\n loadingIndexes: suggestionLoadingIndexes,\n onSelectSuggestion,\n className: \"mb-3 lg:ml-4 lg:mr-4 ml-0 mr-0\",\n },\n )\n : null;\n const BoundFeather = renderSlot(feather, CopilotChatView.Feather, {});\n const BoundScrollView = renderSlot(scrollView, CopilotChatView.ScrollView, {\n autoScroll,\n scrollToBottomButton,\n inputContainerHeight,\n isResizing,\n children: (\n <div style={{ paddingBottom: `${inputContainerHeight + (hasSuggestions ? 4 : 32)}px` }}>\n <div className=\"max-w-3xl mx-auto\">\n {BoundMessageView}\n {hasSuggestions ? <div className=\"px-4 sm:px-0 mt-4\">{BoundSuggestionView}</div> : null}\n </div>\n </div>\n ),\n });\n\n const BoundScrollToBottomButton = renderSlot(scrollToBottomButton, CopilotChatView.ScrollToBottomButton, {});\n\n const BoundDisclaimer = renderSlot(disclaimer, CopilotChatView.Disclaimer, {});\n\n const BoundInputContainer = renderSlot(inputContainer, CopilotChatView.InputContainer, {\n ref: inputContainerRef,\n children: (\n <>\n <div className=\"max-w-3xl mx-auto py-0 px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8 pointer-events-auto\">\n {BoundInput}\n </div>\n {BoundDisclaimer}\n </>\n ),\n });\n\n if (children) {\n return children({\n messageView: BoundMessageView,\n input: BoundInput,\n scrollView: BoundScrollView,\n scrollToBottomButton: BoundScrollToBottomButton,\n feather: BoundFeather,\n inputContainer: BoundInputContainer,\n disclaimer: BoundDisclaimer,\n suggestionView: BoundSuggestionView ?? <></>,\n });\n }\n\n return (\n <div className={twMerge(\"relative h-full\", className)} {...props}>\n {BoundScrollView}\n\n {BoundFeather}\n\n {BoundInputContainer}\n </div>\n );\n}\n\nexport namespace CopilotChatView {\n // Inner component that has access to StickToBottom context\n const ScrollContent: React.FC<{\n children: React.ReactNode;\n scrollToBottomButton?: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement>>;\n inputContainerHeight: number;\n isResizing: boolean;\n }> = ({ children, scrollToBottomButton, inputContainerHeight, isResizing }) => {\n const { isAtBottom, scrollToBottom } = useStickToBottomContext();\n\n return (\n <>\n <StickToBottom.Content className=\"overflow-y-scroll overflow-x-hidden\">\n <div className=\"px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8\">{children}</div>\n </StickToBottom.Content>\n\n {/* Scroll to bottom button - hidden during resize */}\n {!isAtBottom && !isResizing && (\n <div\n className=\"absolute inset-x-0 flex justify-center z-10 pointer-events-none\"\n style={{\n bottom: `${inputContainerHeight + 16}px`,\n }}\n >\n {renderSlot(scrollToBottomButton, CopilotChatView.ScrollToBottomButton, {\n onClick: () => scrollToBottom(),\n })}\n </div>\n )}\n </>\n );\n };\n\n export const ScrollView: React.FC<\n React.HTMLAttributes<HTMLDivElement> & {\n autoScroll?: boolean;\n scrollToBottomButton?: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement>>;\n inputContainerHeight?: number;\n isResizing?: boolean;\n }\n > = ({\n children,\n autoScroll = true,\n scrollToBottomButton,\n inputContainerHeight = 0,\n isResizing = false,\n className,\n ...props\n }) => {\n const [hasMounted, setHasMounted] = useState(false);\n const { scrollRef, contentRef, scrollToBottom } = useStickToBottom();\n const [showScrollButton, setShowScrollButton] = useState(false);\n\n useEffect(() => {\n setHasMounted(true);\n }, []);\n\n // Monitor scroll position for non-autoscroll mode\n useEffect(() => {\n if (autoScroll) return; // Skip for autoscroll mode\n\n const scrollElement = scrollRef.current;\n if (!scrollElement) return;\n\n const checkScroll = () => {\n const atBottom = scrollElement.scrollHeight - scrollElement.scrollTop - scrollElement.clientHeight < 10;\n setShowScrollButton(!atBottom);\n };\n\n checkScroll();\n scrollElement.addEventListener(\"scroll\", checkScroll);\n\n // Also check on resize\n const resizeObserver = new ResizeObserver(checkScroll);\n resizeObserver.observe(scrollElement);\n\n return () => {\n scrollElement.removeEventListener(\"scroll\", checkScroll);\n resizeObserver.disconnect();\n };\n }, [scrollRef, autoScroll]);\n\n if (!hasMounted) {\n return (\n <div className=\"h-full max-h-full flex flex-col min-h-0 overflow-y-scroll overflow-x-hidden\">\n <div className=\"px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8\">{children}</div>\n </div>\n );\n }\n\n // When autoScroll is false, we don't use StickToBottom\n if (!autoScroll) {\n return (\n <div\n ref={scrollRef}\n className={cn(\n \"h-full max-h-full flex flex-col min-h-0 overflow-y-scroll overflow-x-hidden relative\",\n className,\n )}\n {...props}\n >\n <div ref={contentRef} className=\"px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8\">\n {children}\n </div>\n\n {/* Scroll to bottom button for manual mode */}\n {showScrollButton && !isResizing && (\n <div\n className=\"absolute inset-x-0 flex justify-center z-10 pointer-events-none\"\n style={{\n bottom: `${inputContainerHeight + 16}px`,\n }}\n >\n {renderSlot(scrollToBottomButton, CopilotChatView.ScrollToBottomButton, {\n onClick: () => scrollToBottom(),\n })}\n </div>\n )}\n </div>\n );\n }\n\n return (\n <StickToBottom\n className={cn(\"h-full max-h-full flex flex-col min-h-0 relative\", className)}\n resize=\"smooth\"\n initial=\"smooth\"\n {...props}\n >\n <ScrollContent\n scrollToBottomButton={scrollToBottomButton}\n inputContainerHeight={inputContainerHeight}\n isResizing={isResizing}\n >\n {children}\n </ScrollContent>\n </StickToBottom>\n );\n };\n\n export const ScrollToBottomButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement>> = ({\n className,\n ...props\n }) => (\n <Button\n variant=\"outline\"\n size=\"sm\"\n className={twMerge(\n \"rounded-full w-10 h-10 p-0 pointer-events-auto\",\n \"bg-white dark:bg-gray-900\",\n \"shadow-lg border border-gray-200 dark:border-gray-700\",\n \"hover:bg-gray-50 dark:hover:bg-gray-800\",\n \"flex items-center justify-center cursor-pointer\",\n className,\n )}\n {...props}\n >\n <ChevronDown className=\"w-4 h-4 text-gray-600 dark:text-white\" />\n </Button>\n );\n\n export const Feather: React.FC<React.HTMLAttributes<HTMLDivElement>> = ({ className, style, ...props }) => (\n <div\n className={cn(\n \"absolute bottom-0 left-0 right-4 h-24 pointer-events-none z-10 bg-gradient-to-t\",\n \"from-white via-white to-transparent\",\n \"dark:from-[rgb(33,33,33)] dark:via-[rgb(33,33,33)]\",\n className,\n )}\n style={style}\n {...props}\n />\n );\n\n export const InputContainer = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement> & { children: React.ReactNode }\n >(({ children, className, ...props }, ref) => (\n <div ref={ref} className={cn(\"absolute bottom-0 left-0 right-0 z-20 pointer-events-none\", className)} {...props}>\n {children}\n </div>\n ));\n\n InputContainer.displayName = \"CopilotChatView.InputContainer\";\n\n export const Disclaimer: React.FC<React.HTMLAttributes<HTMLDivElement>> = ({ className, ...props }) => {\n const config = useCopilotChatConfiguration();\n const labels = config?.labels ?? CopilotChatDefaultLabels;\n\n return (\n <div\n className={cn(\"text-center text-xs text-muted-foreground py-3 px-4 max-w-3xl mx-auto\", className)}\n {...props}\n >\n {labels.chatDisclaimerText}\n </div>\n );\n };\n}\n\nexport default CopilotChatView;\n","import { useAgent } from \"@/hooks/use-agent\";\nimport { useSuggestions } from \"@/hooks/use-suggestions\";\nimport { CopilotChatView, CopilotChatViewProps } from \"./CopilotChatView\";\nimport {\n CopilotChatConfigurationProvider,\n CopilotChatLabels,\n useCopilotChatConfiguration,\n} from \"@/providers/CopilotChatConfigurationProvider\";\nimport { DEFAULT_AGENT_ID, randomUUID } from \"@copilotkitnext/shared\";\nimport { Suggestion } from \"@copilotkitnext/core\";\nimport { useCallback, useEffect, useMemo } from \"react\";\nimport { merge } from \"ts-deepmerge\";\nimport { useCopilotKit } from \"@/providers/CopilotKitProvider\";\nimport { AbstractAgent, AGUIConnectNotImplementedError } from \"@ag-ui/client\";\nimport { renderSlot, SlotValue } from \"@/lib/slots\";\n\nexport type CopilotChatProps = Omit<\n CopilotChatViewProps,\n \"messages\" | \"isRunning\" | \"suggestions\" | \"suggestionLoadingIndexes\" | \"onSelectSuggestion\"\n> & {\n agentId?: string;\n threadId?: string;\n labels?: Partial<CopilotChatLabels>;\n chatView?: SlotValue<typeof CopilotChatView>;\n isModalDefaultOpen?: boolean;\n};\nexport function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen, ...props }: CopilotChatProps) {\n // Check for existing configuration provider\n const existingConfig = useCopilotChatConfiguration();\n\n // Apply priority: props > existing config > defaults\n const resolvedAgentId = agentId ?? existingConfig?.agentId ?? DEFAULT_AGENT_ID;\n const resolvedThreadId = useMemo(\n () => threadId ?? existingConfig?.threadId ?? randomUUID(),\n [threadId, existingConfig?.threadId],\n );\n const { agent } = useAgent({ agentId: resolvedAgentId });\n const { copilotkit } = useCopilotKit();\n\n const { suggestions: autoSuggestions } = useSuggestions({ agentId: resolvedAgentId });\n\n const {\n inputProps: providedInputProps,\n messageView: providedMessageView,\n suggestionView: providedSuggestionView,\n ...restProps\n } = props;\n\n useEffect(() => {\n const connect = async (agent: AbstractAgent) => {\n try {\n await copilotkit.connectAgent({ agent });\n } catch (error) {\n if (error instanceof AGUIConnectNotImplementedError) {\n // connect not implemented, ignore\n } else {\n throw error;\n }\n }\n };\n if (agent) {\n agent.threadId = resolvedThreadId;\n connect(agent);\n }\n return () => {};\n }, [resolvedThreadId, agent, copilotkit, resolvedAgentId]);\n\n const onSubmitInput = useCallback(\n async (value: string) => {\n agent?.addMessage({\n id: randomUUID(),\n role: \"user\",\n content: value,\n });\n if (agent) {\n try {\n await copilotkit.runAgent({ agent });\n } catch (error) {\n console.error(\"CopilotChat: runAgent failed\", error);\n }\n }\n },\n [agent, copilotkit],\n );\n\n const handleSelectSuggestion = useCallback(\n async (suggestion: Suggestion) => {\n if (!agent) {\n return;\n }\n\n agent.addMessage({\n id: randomUUID(),\n role: \"user\",\n content: suggestion.message,\n });\n\n try {\n await copilotkit.runAgent({ agent });\n } catch (error) {\n console.error(\"CopilotChat: runAgent failed after selecting suggestion\", error);\n }\n },\n [agent, copilotkit],\n );\n\n const mergedProps = merge(\n {\n isRunning: agent?.isRunning ?? false,\n suggestions: autoSuggestions,\n onSelectSuggestion: handleSelectSuggestion,\n suggestionView: providedSuggestionView,\n },\n {\n ...restProps,\n ...(typeof providedMessageView === \"string\"\n ? { messageView: { className: providedMessageView } }\n : providedMessageView !== undefined\n ? { messageView: providedMessageView }\n : {}),\n },\n );\n\n const finalProps = merge(mergedProps, {\n messages: agent?.messages ?? [],\n inputProps: {\n onSubmitMessage: onSubmitInput,\n ...providedInputProps,\n },\n }) as CopilotChatViewProps;\n\n // Always create a provider with merged values\n // This ensures priority: props > existing config > defaults\n const RenderedChatView = renderSlot(chatView, CopilotChatView, finalProps);\n\n return (\n <CopilotChatConfigurationProvider\n agentId={resolvedAgentId}\n threadId={resolvedThreadId}\n labels={labels}\n isModalDefaultOpen={isModalDefaultOpen}\n >\n {RenderedChatView}\n </CopilotChatConfigurationProvider>\n );\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace CopilotChat {\n export const View = CopilotChatView;\n}\n","import React, { useState, MouseEvent } from \"react\";\nimport { MessageCircle, X } from \"lucide-react\";\n\nimport { renderSlot, SlotValue } from \"@/lib/slots\";\nimport { cn } from \"@/lib/utils\";\nimport {\n CopilotChatDefaultLabels,\n useCopilotChatConfiguration,\n} from \"@/providers/CopilotChatConfigurationProvider\";\n\nconst DefaultOpenIcon: React.FC<React.SVGProps<SVGSVGElement>> = ({\n className,\n ...props\n}) => (\n <MessageCircle className={cn(\"h-6 w-6\", className)} strokeWidth={1.75} fill=\"currentColor\" {...props} />\n);\n\nconst DefaultCloseIcon: React.FC<React.SVGProps<SVGSVGElement>> = ({\n className,\n ...props\n}) => <X className={cn(\"h-6 w-6\", className)} strokeWidth={1.75} {...props} />;\n\nDefaultOpenIcon.displayName = \"CopilotChatToggleButton.OpenIcon\";\nDefaultCloseIcon.displayName = \"CopilotChatToggleButton.CloseIcon\";\n\nexport interface CopilotChatToggleButtonProps\n extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"children\"> {\n /** Optional slot override for the chat (closed) icon. */\n openIcon?: SlotValue<typeof DefaultOpenIcon>;\n /** Optional slot override for the close icon. */\n closeIcon?: SlotValue<typeof DefaultCloseIcon>;\n}\n\nconst ICON_TRANSITION_STYLE: React.CSSProperties = Object.freeze({\n transition: \"opacity 120ms ease-out, transform 260ms cubic-bezier(0.22, 1, 0.36, 1)\",\n});\n\nconst ICON_WRAPPER_BASE =\n \"pointer-events-none absolute inset-0 flex items-center justify-center will-change-transform\";\n\nconst BUTTON_BASE_CLASSES = cn(\n \"fixed bottom-6 right-6 z-[1100] flex h-14 w-14 items-center justify-center\",\n \"rounded-full border border-primary bg-primary text-primary-foreground\",\n \"shadow-sm transition-all duration-200 ease-out\",\n \"hover:scale-[1.04] hover:shadow-md\",\n \"cursor-pointer\",\n \"active:scale-[0.96]\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n \"disabled:pointer-events-none disabled:opacity-60\"\n);\n\nexport const CopilotChatToggleButton = React.forwardRef<\n HTMLButtonElement,\n CopilotChatToggleButtonProps\n>(function CopilotChatToggleButton({ openIcon, closeIcon, className, ...buttonProps }, ref) {\n const { onClick, type, disabled, ...restProps } = buttonProps;\n\n const configuration = useCopilotChatConfiguration();\n const labels = configuration?.labels ?? CopilotChatDefaultLabels;\n\n const [fallbackOpen, setFallbackOpen] = useState(false);\n\n const isOpen = configuration?.isModalOpen ?? fallbackOpen;\n const setModalOpen = configuration?.setModalOpen ?? setFallbackOpen;\n\n const handleClick = (event: MouseEvent<HTMLButtonElement>) => {\n if (disabled) {\n return;\n }\n\n if (onClick) {\n onClick(event);\n }\n\n if (event.defaultPrevented) {\n return;\n }\n\n const nextOpen = !isOpen;\n setModalOpen(nextOpen);\n };\n\n const renderedOpenIcon = renderSlot(\n openIcon,\n DefaultOpenIcon,\n {\n className: \"h-6 w-6\",\n \"aria-hidden\": true,\n focusable: false,\n }\n );\n\n const renderedCloseIcon = renderSlot(\n closeIcon,\n DefaultCloseIcon,\n {\n className: \"h-6 w-6\",\n \"aria-hidden\": true,\n focusable: false,\n }\n );\n\n const openIconElement = (\n <span\n aria-hidden=\"true\"\n data-slot=\"chat-toggle-button-open-icon\"\n className={ICON_WRAPPER_BASE}\n style={{\n ...ICON_TRANSITION_STYLE,\n opacity: isOpen ? 0 : 1,\n transform: `scale(${isOpen ? 0.75 : 1}) rotate(${isOpen ? 90 : 0}deg)`,\n }}\n >\n {renderedOpenIcon}\n </span>\n );\n\n const closeIconElement = (\n <span\n aria-hidden=\"true\"\n data-slot=\"chat-toggle-button-close-icon\"\n className={ICON_WRAPPER_BASE}\n style={{\n ...ICON_TRANSITION_STYLE,\n opacity: isOpen ? 1 : 0,\n transform: `scale(${isOpen ? 1 : 0.75}) rotate(${isOpen ? 0 : -90}deg)`,\n }}\n >\n {renderedCloseIcon}\n </span>\n );\n\n return (\n <button\n ref={ref}\n type={type ?? \"button\"}\n data-slot=\"chat-toggle-button\"\n data-state={isOpen ? \"open\" : \"closed\"}\n className={cn(BUTTON_BASE_CLASSES, className)}\n aria-label={isOpen ? labels.chatToggleCloseLabel : labels.chatToggleOpenLabel}\n aria-pressed={isOpen}\n disabled={disabled}\n onClick={handleClick}\n {...restProps}\n >\n {openIconElement}\n {closeIconElement}\n </button>\n );\n});\nCopilotChatToggleButton.displayName = \"CopilotChatToggleButton\";\nexport default CopilotChatToggleButton;\n\nexport {\n DefaultOpenIcon as CopilotChatToggleButtonOpenIcon,\n DefaultCloseIcon as CopilotChatToggleButtonCloseIcon,\n};\n","import React, { useEffect, useRef, useState } from \"react\";\n\nimport CopilotChatView, { CopilotChatViewProps } from \"./CopilotChatView\";\nimport { useCopilotChatConfiguration } from \"@/providers/CopilotChatConfigurationProvider\";\nimport CopilotChatToggleButton from \"./CopilotChatToggleButton\";\nimport { cn } from \"@/lib/utils\";\nimport { CopilotModalHeader } from \"./CopilotModalHeader\";\nimport { renderSlot, SlotValue } from \"@/lib/slots\";\n\nconst DEFAULT_SIDEBAR_WIDTH = 480;\nconst SIDEBAR_TRANSITION_MS = 260;\n\nexport type CopilotSidebarViewProps = CopilotChatViewProps & {\n header?: SlotValue<typeof CopilotModalHeader>;\n width?: number | string;\n};\n\nexport function CopilotSidebarView({ header, width, ...props }: CopilotSidebarViewProps) {\n const configuration = useCopilotChatConfiguration();\n\n const isSidebarOpen = configuration?.isModalOpen ?? false;\n\n const sidebarRef = useRef<HTMLDivElement | null>(null);\n const [sidebarWidth, setSidebarWidth] = useState<number | string>(width ?? DEFAULT_SIDEBAR_WIDTH);\n\n // Helper to convert width to CSS value\n const widthToCss = (w: number | string): string => {\n return typeof w === \"number\" ? `${w}px` : w;\n };\n\n // Helper to extract numeric value for body margin (only works with px values)\n const widthToMargin = (w: number | string): string => {\n if (typeof w === \"number\") {\n return `${w}px`;\n }\n // For string values, use as-is (assumes valid CSS unit)\n return w;\n };\n\n useEffect(() => {\n // If width is explicitly provided, don't measure\n if (width !== undefined) {\n return;\n }\n\n if (typeof window === \"undefined\") {\n return;\n }\n\n const element = sidebarRef.current;\n if (!element) {\n return;\n }\n\n const updateWidth = () => {\n const rect = element.getBoundingClientRect();\n if (rect.width > 0) {\n setSidebarWidth(rect.width);\n }\n };\n\n updateWidth();\n\n if (typeof ResizeObserver !== \"undefined\") {\n const observer = new ResizeObserver(() => updateWidth());\n observer.observe(element);\n return () => observer.disconnect();\n }\n\n window.addEventListener(\"resize\", updateWidth);\n return () => window.removeEventListener(\"resize\", updateWidth);\n }, [width]);\n\n const headerElement = renderSlot(header, CopilotModalHeader, {});\n\n return (\n <>\n {isSidebarOpen && (\n <style\n dangerouslySetInnerHTML={{\n __html: `body {\n margin-inline-end: ${widthToMargin(sidebarWidth)};\n transition: margin-inline-end ${SIDEBAR_TRANSITION_MS}ms ease;\n }`,\n }}\n />\n )}\n <CopilotChatToggleButton />\n <aside\n ref={sidebarRef}\n data-copilot-sidebar\n className={cn(\n \"fixed right-0 top-0 z-[1200] flex h-dvh max-h-screen\",\n \"border-l border-border bg-background text-foreground shadow-xl\",\n \"transition-transform duration-300 ease-out\",\n isSidebarOpen ? \"translate-x-0\" : \"translate-x-full pointer-events-none\",\n )}\n style={{ width: widthToCss(sidebarWidth) }}\n aria-hidden={!isSidebarOpen}\n aria-label=\"Copilot chat sidebar\"\n role=\"complementary\"\n >\n <div className=\"flex h-full w-full flex-col overflow-hidden\">\n {headerElement}\n <div className=\"flex-1 overflow-hidden\" data-sidebar-chat>\n <CopilotChatView {...props} />\n </div>\n </div>\n </aside>\n </>\n );\n}\n\nCopilotSidebarView.displayName = \"CopilotSidebarView\";\n\nexport default CopilotSidebarView;\n","import React, { useCallback } from \"react\";\n\nimport { cn } from \"@/lib/utils\";\nimport { useCopilotChatConfiguration, CopilotChatDefaultLabels } from \"@/providers/CopilotChatConfigurationProvider\";\nimport { renderSlot, WithSlots } from \"@/lib/slots\";\nimport { X } from \"lucide-react\";\n\ntype HeaderSlots = {\n titleContent: typeof CopilotModalHeader.Title;\n closeButton: typeof CopilotModalHeader.CloseButton;\n};\n\ntype HeaderRestProps = {\n title?: string;\n} & Omit<React.HTMLAttributes<HTMLDivElement>, \"children\">;\n\nexport type CopilotModalHeaderProps = WithSlots<HeaderSlots, HeaderRestProps>;\n\nexport function CopilotModalHeader({\n title,\n titleContent,\n closeButton,\n children,\n className,\n ...rest\n}: CopilotModalHeaderProps) {\n const configuration = useCopilotChatConfiguration();\n\n const fallbackTitle = configuration?.labels.modalHeaderTitle ?? CopilotChatDefaultLabels.modalHeaderTitle;\n const resolvedTitle = title ?? fallbackTitle;\n\n const handleClose = useCallback(() => {\n configuration?.setModalOpen(false);\n }, [configuration]);\n\n const BoundTitle = renderSlot(titleContent, CopilotModalHeader.Title, {\n children: resolvedTitle,\n });\n\n const BoundCloseButton = renderSlot(closeButton, CopilotModalHeader.CloseButton, {\n onClick: handleClose,\n });\n\n if (children) {\n return children({\n titleContent: BoundTitle,\n closeButton: BoundCloseButton,\n title: resolvedTitle,\n ...rest,\n });\n }\n\n return (\n <header\n data-slot=\"copilot-modal-header\"\n className={cn(\n \"flex items-center justify-between border-b border-border px-4 py-4\",\n \"bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80\",\n className,\n )}\n {...rest}\n >\n <div className=\"flex w-full items-center gap-2\">\n <div className=\"flex-1\" aria-hidden=\"true\" />\n <div className=\"flex flex-1 justify-center text-center\">{BoundTitle}</div>\n <div className=\"flex flex-1 justify-end\">{BoundCloseButton}</div>\n </div>\n </header>\n );\n}\n\nCopilotModalHeader.displayName = \"CopilotModalHeader\";\n\nexport namespace CopilotModalHeader {\n export const Title: React.FC<React.HTMLAttributes<HTMLDivElement>> = ({ children, className, ...props }) => (\n <div\n className={cn(\n \"w-full text-base font-medium leading-none tracking-tight text-foreground\",\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n\n export const CloseButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement>> = ({\n className,\n ...props\n }) => (\n <button\n type=\"button\"\n className={cn(\n \"inline-flex size-8 items-center justify-center rounded-full text-muted-foreground transition cursor-pointer\",\n \"hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n className,\n )}\n aria-label=\"Close\"\n {...props}\n >\n <X className=\"h-4 w-4\" aria-hidden=\"true\" />\n </button>\n );\n}\n\nCopilotModalHeader.Title.displayName = \"CopilotModalHeader.Title\";\nCopilotModalHeader.CloseButton.displayName = \"CopilotModalHeader.CloseButton\";\n\nexport default CopilotModalHeader;\n","import React, { useMemo } from \"react\";\n\nimport { CopilotChat, CopilotChatProps } from \"./CopilotChat\";\nimport CopilotChatView, { CopilotChatViewProps } from \"./CopilotChatView\";\nimport { CopilotSidebarView, CopilotSidebarViewProps } from \"./CopilotSidebarView\";\n\nexport type CopilotSidebarProps = Omit<CopilotChatProps, \"chatView\"> & {\n header?: CopilotSidebarViewProps[\"header\"];\n defaultOpen?: boolean;\n width?: number | string;\n};\n\nexport function CopilotSidebar({ header, defaultOpen, width, ...chatProps }: CopilotSidebarProps) {\n const SidebarViewOverride = useMemo(() => {\n const Component: React.FC<CopilotChatViewProps> = (viewProps) => {\n const { header: viewHeader, width: viewWidth, ...restProps } = viewProps as CopilotSidebarViewProps;\n\n return (\n <CopilotSidebarView\n {...(restProps as CopilotSidebarViewProps)}\n header={header ?? viewHeader}\n width={width ?? viewWidth}\n />\n );\n };\n\n return Object.assign(Component, CopilotChatView);\n }, [header, width]);\n\n return (\n <CopilotChat\n {...chatProps}\n chatView={SidebarViewOverride}\n isModalDefaultOpen={defaultOpen}\n />\n );\n}\n\nCopilotSidebar.displayName = \"CopilotSidebar\";\n\nexport default CopilotSidebar;\n","import React from \"react\";\nimport { z } from \"zod\";\nimport { ReactToolCallRender } from \"./react-tool-call-render\";\nimport { ToolCallStatus } from \"@copilotkitnext/core\";\n\n/**\n * Helper to define a type-safe tool call render entry.\n * - Accepts a single object whose keys match ReactToolCallRender's fields: { name, args, render, agentId? }.\n * - Derives `args` type from the provided Zod schema.\n * - Ensures the render function param type exactly matches ReactToolCallRender<T>[\"render\"]'s param.\n * - For wildcard tools (name: \"*\"), args is optional and defaults to z.any()\n */\ntype RenderProps<T> =\n | {\n name: string;\n args: Partial<T>;\n status: ToolCallStatus.InProgress;\n result: undefined;\n }\n | {\n name: string;\n args: T;\n status: ToolCallStatus.Executing;\n result: undefined;\n }\n | {\n name: string;\n args: T;\n status: ToolCallStatus.Complete;\n result: string;\n };\n\n// Overload for wildcard tools without args\nexport function defineToolCallRender(def: {\n name: \"*\";\n render: (props: RenderProps<any>) => React.ReactElement;\n agentId?: string;\n}): ReactToolCallRender<any>;\n\n// Overload for regular tools with args\nexport function defineToolCallRender<S extends z.ZodTypeAny>(def: {\n name: string;\n args: S;\n render: (props: RenderProps<z.infer<S>>) => React.ReactElement;\n agentId?: string;\n}): ReactToolCallRender<z.infer<S>>;\n\n// Implementation\nexport function defineToolCallRender<S extends z.ZodTypeAny>(def: {\n name: string;\n args?: S;\n render: (props: any) => React.ReactElement;\n agentId?: string;\n}): ReactToolCallRender<any> {\n // For wildcard tools, default to z.any() if no args provided\n const argsSchema = def.name === \"*\" && !def.args ? z.any() : def.args;\n\n return {\n name: def.name,\n args: argsSchema as any,\n render: def.render as React.ComponentType<any>,\n ...(def.agentId ? { agentId: def.agentId } : {}),\n };\n}\n","import { defineToolCallRender } from \"../types/defineToolCallRender\";\nimport { useState } from \"react\";\n\nexport const WildcardToolCallRender = defineToolCallRender({\n name: \"*\",\n render: ({ args, result, name, status }) => {\n const [isExpanded, setIsExpanded] = useState(false);\n\n const statusString = String(status) as\n | \"inProgress\"\n | \"executing\"\n | \"complete\";\n const isActive =\n statusString === \"inProgress\" || statusString === \"executing\";\n const isComplete = statusString === \"complete\";\n const statusStyles = isActive\n ? \"bg-amber-100 text-amber-800 dark:bg-amber-500/15 dark:text-amber-400\"\n : isComplete\n ? \"bg-emerald-100 text-emerald-800 dark:bg-emerald-500/15 dark:text-emerald-400\"\n : \"bg-zinc-100 text-zinc-800 dark:bg-zinc-700/40 dark:text-zinc-300\";\n\n return (\n <div className=\"mt-2 pb-2\">\n <div className=\"rounded-xl border border-zinc-200/60 dark:border-zinc-800/60 bg-white/70 dark:bg-zinc-900/50 shadow-sm backdrop-blur p-4\">\n <div\n className=\"flex items-center justify-between gap-3 cursor-pointer\"\n onClick={() => setIsExpanded(!isExpanded)}\n >\n <div className=\"flex items-center gap-2 min-w-0\">\n <svg\n className={`h-4 w-4 text-zinc-500 dark:text-zinc-400 transition-transform ${\n isExpanded ? \"rotate-90\" : \"\"\n }`}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth={2}\n stroke=\"currentColor\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M8.25 4.5l7.5 7.5-7.5 7.5\"\n />\n </svg>\n <span className=\"inline-block h-2 w-2 rounded-full bg-blue-500\" />\n <span className=\"truncate text-sm font-medium text-zinc-900 dark:text-zinc-100\">\n {name}\n </span>\n </div>\n <span\n className={`inline-flex items-center rounded-full px-2 py-1 text-xs font-medium ${statusStyles}`}\n >\n {String(status)}\n </span>\n </div>\n\n {isExpanded && (\n <div className=\"mt-3 grid gap-4\">\n <div>\n <div className=\"text-xs uppercase tracking-wide text-zinc-500 dark:text-zinc-400\">\n Arguments\n </div>\n <pre className=\"mt-2 max-h-64 overflow-auto rounded-md bg-zinc-50 dark:bg-zinc-800/60 p-3 text-xs leading-relaxed text-zinc-800 dark:text-zinc-200 whitespace-pre-wrap break-words\">\n {JSON.stringify(args ?? {}, null, 2)}\n </pre>\n </div>\n\n {result !== undefined && (\n <div>\n <div className=\"text-xs uppercase tracking-wide text-zinc-500 dark:text-zinc-400\">\n Result\n </div>\n <pre className=\"mt-2 max-h-64 overflow-auto rounded-md bg-zinc-50 dark:bg-zinc-800/60 p-3 text-xs leading-relaxed text-zinc-800 dark:text-zinc-200 whitespace-pre-wrap break-words\">\n {typeof result === \"string\"\n ? result\n : JSON.stringify(result, null, 2)}\n </pre>\n </div>\n )}\n </div>\n )}\n </div>\n </div>\n );\n },\n});\n"],"mappings":";;;AAAA,SAAgB,YAAAA,WAAU,UAAAC,SAAoC,aAAAC,YAAW,cAAAC,aAAY,uBAAAC,4BAA2B;AAChH,SAAS,WAAAC,gBAAe;AACxB,SAAS,MAAM,WAAW,KAAK,SAAS,GAAG,aAAa;;;ACFxD,SAAgB,eAAe,YAAuB,SAAS,gBAAgB;AAC/E,SAAS,kBAAkB,kBAAkB;AA0GzC;AAvGG,IAAM,2BAA2B;AAAA,EACtC,sBAAsB;AAAA,EACtB,4CAA4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I,WAAU,mBACb;AAAA,wBAAAA,OAAC,SACC;AAAA,0BAAAD,MAAC,SAAI,WAAU,oEAAmE,uBAElF;AAAA,UACA,gBAAAA,MAAC,SAAI,WAAU,sKACZ,eAAK,UAAU,QAAQ,CAAC,GAAG,MAAM,CAAC,GACrC;AAAA,WACF;AAAA,QAEC,WAAW,UACV,gBAAAC,OAAC,SACC;AAAA,0BAAAD,MAAC,SAAI,WAAU,oEAAmE,oBAElF;AAAA,UACA,gBAAAA,MAAC,SAAI,WAAU,sKACZ,iBAAO,WAAW,WACf,SACA,KAAK,UAAU,QAAQ,MAAM,CAAC,GACpC;AAAA,WACF;AAAA,SAEJ;AAAA,OAEJ,GACF;AAAA,EAEJ;AACF,CAAC;","names":["useState","useRef","useEffect","forwardRef","useImperativeHandle","twMerge","jsx","jsx","jsx","jsxs","jsx","jsx","jsx","jsx","jsxs","twMerge","jsx","React","jsx","jsxs","useState","useEffect","useRef","twMerge","CopilotChatInput","forwardRef","TextArea","useImperativeHandle","useState","Check","twMerge","useEffect","useState","createContext","useContext","useMemo","useEffect","useState","useRef","jsx","copilotkit","DEFAULT_AGENT_ID","jsx","useState","useEffect","useEffect","useEffect","useState","useCallback","useRef","useEffect","React","useState","useRef","useCallback","React","useEffect","useMemo","useEffect","useReducer","DEFAULT_AGENT_ID","DEFAULT_AGENT_ID","useReducer","useMemo","useEffect","useEffect","useCallback","useEffect","useMemo","useState","DEFAULT_AGENT_ID","useMemo","useState","useEffect","suggestions","useCallback","useCallback","useEffect","useMemo","useRef","DEFAULT_AGENT_ID","useMemo","useRef","useCallback","useEffect","React","Fragment","jsx","Fragment","jsx","jsxs","twMerge","CopilotChatAssistantMessage","useState","Check","className","useState","Copy","Check","twMerge","Fragment","jsx","jsxs","twMerge","CopilotChatUserMessage","useState","Check","Copy","React","jsx","jsxs","React","CopilotChatSuggestionPill","React","Fragment","jsx","jsxs","React","DefaultContainer","CopilotChatSuggestionView","twMerge","jsx","jsxs","React","useRef","useState","useEffect","twMerge","Fragment","jsx","jsxs","useRef","useState","useEffect","twMerge","CopilotChatView","React","DEFAULT_AGENT_ID","randomUUID","useCallback","useEffect","useMemo","jsx","DEFAULT_AGENT_ID","useMemo","randomUUID","useEffect","agent","useCallback","CopilotChat","React","useState","X","jsx","jsxs","X","React","CopilotChatToggleButton","useState","useEffect","useRef","useState","useCallback","X","jsx","jsxs","useCallback","CopilotModalHeader","Fragment","jsx","jsxs","useRef","useState","useEffect","useMemo","jsx","useMemo","z","useState","jsx","jsxs"]}