@usecrow/ui 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/CrowProvider.tsx","../src/hooks/useChat.ts","../src/components/ChatBubble.tsx","../src/components/WidgetHeader.tsx","../src/components/MessageBubble.tsx","../src/components/MessageList.tsx","../src/components/PromptInput.tsx","../src/CrowWidget.tsx","../src/CrowCopilot.tsx","../src/hooks/useIdentity.ts","../src/hooks/useConversations.ts"],"names":["createContext","useRef","CrowClient","client","useEffect","useMemo","jsx","useContext","useState","useCallback","clsx","jsxs","Fragment"],"mappings":";;;;;;;AAWA,IAAM,WAAA,GAAcA,oBAAuC,IAAI,CAAA;AASxD,SAAS,YAAA,CAAa;AAAA,EAC3B,QAAA;AAAA,EACA,SAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAA,EAAsB;AAEpB,EAAA,MAAM,SAAA,GAAYC,aAA0B,IAAI,CAAA;AAEhD,EAAA,IAAI,CAAC,UAAU,OAAA,EAAS;AACtB,IAAA,SAAA,CAAU,UAAU,IAAIC,iBAAA,CAAW,EAAE,SAAA,EAAW,MAAA,EAAQ,OAAO,CAAA;AAAA,EACjE;AAEA,EAAA,MAAMC,WAAS,SAAA,CAAU,OAAA;AAGzB,EAAAC,eAAA,CAAU,MAAM;AACd,IAAA,OAAO,MAAM;AACX,MAAAD,QAAA,CAAO,OAAA,EAAQ;AAAA,IACjB,CAAA;AAAA,EACF,CAAA,EAAG,CAACA,QAAM,CAAC,CAAA;AAEX,EAAA,MAAM,KAAA,GAAQE,cAAQ,OAAO,UAAEF,UAAO,CAAA,EAAI,CAACA,QAAM,CAAC,CAAA;AAElD,EAAA,uBAAOG,cAAA,CAAC,WAAA,CAAY,QAAA,EAAZ,EAAqB,OAAe,QAAA,EAAS,CAAA;AACvD;AAKO,SAAS,aAAA,GAA4B;AAC1C,EAAA,MAAM,OAAA,GAAUC,iBAAW,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AqBA,iBAAAA;AAAA,IACzB,OAAO,cAAA,KAA2B;AAChC,MAAA,mBAAA,CAAoB,IAAI,CAAA;AACxB,MAAA,IAAI;AACF,QAAA,MAAM,MAAA,CAAO,mBAAmB,cAAc,CAAA;AAAA,MAChD,CAAA,SAAE;AACA,QAAA,mBAAA,CAAoB,KAAK,CAAA;AAAA,MAC3B;AAAA,IACF,CAAA;AAAA,IACA,CAAC,MAAM;AAAA,GACT;AAEA,EAAA,MAAM,oBAAA,GAAuBA,kBAAY,MAAM;AAC7C,IAAA,MAAA,CAAO,aAAA,EAAc;AAAA,EACvB,CAAA,EAAG,CAAC,MAAM,CAAC,CAAA;AAEX,EAAA,OAAO;AAAA,IACL,aAAA;AAAA,IACA,sBAAA;AAAA,IACA,gBAAA;AAAA,IACA,uBAAuB,MAAA,CAAO,cAAA;AAAA,IAC9B,iBAAA;AAAA,IACA,WAAA;AAAA,IACA,kBAAA;AAAA,IACA;AAAA,GACF;AACF","file":"index.cjs","sourcesContent":["/**\n * CrowProvider - React context provider for sharing CrowClient\n */\n\nimport { createContext, useContext, useMemo, useEffect, useRef } from 'react';\nimport { CrowClient, type CrowClientConfig } from '@usecrow/client';\n\ninterface CrowContextValue {\n client: CrowClient;\n}\n\nconst CrowContext = createContext<CrowContextValue | null>(null);\n\nexport interface CrowProviderProps extends CrowClientConfig {\n children: React.ReactNode;\n}\n\n/**\n * Provider component that creates and shares a CrowClient instance\n */\nexport function CrowProvider({\n children,\n productId,\n apiUrl,\n model,\n}: CrowProviderProps) {\n // Create client once and keep it stable\n const clientRef = useRef<CrowClient | null>(null);\n\n if (!clientRef.current) {\n clientRef.current = new CrowClient({ productId, apiUrl, model });\n }\n\n const client = clientRef.current;\n\n // Clean up on unmount\n useEffect(() => {\n return () => {\n client.destroy();\n };\n }, [client]);\n\n const value = useMemo(() => ({ client }), [client]);\n\n return <CrowContext.Provider value={value}>{children}</CrowContext.Provider>;\n}\n\n/**\n * Hook to access the CrowClient from context\n */\nexport function useCrowClient(): CrowClient {\n const context = useContext(CrowContext);\n if (!context) {\n throw new Error('useCrowClient must be used within a CrowProvider');\n }\n return context.client;\n}\n\n/**\n * Hook to optionally access the CrowClient (returns null if not in provider)\n */\nexport function useCrowClientOptional(): CrowClient | null {\n const context = useContext(CrowContext);\n return context?.client ?? null;\n}\n\n","/**\n * useChat - React hook for chat functionality\n */\n\nimport { useState, useCallback, useEffect, useRef } from 'react';\nimport { CrowClient, type Message, type StreamEvent } from '@usecrow/client';\n\ninterface UseChatOptions {\n client: CrowClient;\n onStreamEvent?: (event: StreamEvent) => void;\n}\n\ninterface UseChatReturn {\n messages: Message[];\n isLoading: boolean;\n sendMessage: (content: string) => Promise<void>;\n stop: () => void;\n clearMessages: () => void;\n}\n\n/**\n * React hook that wraps CrowClient chat functionality\n */\nexport function useChat({ client, onStreamEvent }: UseChatOptions): UseChatReturn {\n const [messages, setMessages] = useState<Message[]>(client.messages);\n const [isLoading, setIsLoading] = useState(client.isLoading);\n const onStreamEventRef = useRef(onStreamEvent);\n\n // Keep ref updated\n useEffect(() => {\n onStreamEventRef.current = onStreamEvent;\n });\n\n // Subscribe to client state changes\n useEffect(() => {\n const unsubMessages = client.onMessages(setMessages);\n const unsubLoading = client.onLoading(setIsLoading);\n\n // Sync initial state\n setMessages(client.messages);\n setIsLoading(client.isLoading);\n\n return () => {\n unsubMessages();\n unsubLoading();\n };\n }, [client]);\n\n const sendMessage = useCallback(\n async (content: string) => {\n for await (const event of client.sendMessage(content)) {\n onStreamEventRef.current?.(event);\n }\n },\n [client]\n );\n\n const stop = useCallback(() => {\n client.stop();\n }, [client]);\n\n const clearMessages = useCallback(() => {\n client.clearMessages();\n }, [client]);\n\n return {\n messages,\n isLoading,\n sendMessage,\n stop,\n clearMessages,\n };\n}\n\n","/**\n * ChatBubble - Floating action button to open/close widget\n */\n\nimport { clsx } from 'clsx';\n\ninterface ChatBubbleProps {\n isOpen: boolean;\n onClick: () => void;\n className?: string;\n}\n\nexport function ChatBubble({ isOpen, onClick, className }: ChatBubbleProps) {\n return (\n <button\n onClick={onClick}\n className={clsx(\n 'crow-fixed crow-z-[999999] crow-rounded-full',\n 'crow-w-14 crow-h-14 crow-flex crow-items-center crow-justify-center',\n 'crow-bg-crow-primary hover:crow-bg-crow-primary-dark',\n 'crow-shadow-lg hover:crow-shadow-xl crow-transition-all crow-duration-300',\n 'hover:crow-scale-110',\n className\n )}\n style={{\n right: '20px',\n bottom: '20px',\n }}\n aria-label={isOpen ? 'Close chat' : 'Open chat'}\n >\n {isOpen ? (\n <svg\n className=\"crow-w-6 crow-h-6 crow-text-white\"\n fill=\"none\"\n stroke=\"currentColor\"\n viewBox=\"0 0 24 24\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M19 9l-7 7-7-7\"\n />\n </svg>\n ) : (\n <svg\n className=\"crow-w-6 crow-h-6 crow-text-white\"\n fill=\"none\"\n stroke=\"currentColor\"\n viewBox=\"0 0 24 24\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z\"\n />\n </svg>\n )}\n </button>\n );\n}\n\n","/**\n * WidgetHeader - Header bar for widget/copilot\n */\n\nimport { clsx } from 'clsx';\n\ninterface WidgetHeaderProps {\n title?: string;\n onNewChat?: () => void;\n onClose?: () => void;\n showNewChat?: boolean;\n showClose?: boolean;\n className?: string;\n}\n\nexport function WidgetHeader({\n title = 'Chat',\n onNewChat,\n onClose,\n showNewChat = true,\n showClose = false,\n className,\n}: WidgetHeaderProps) {\n return (\n <div\n className={clsx(\n 'crow-flex crow-items-center crow-justify-between crow-px-4 crow-py-3',\n 'crow-border-b crow-border-gray-200 crow-bg-white',\n className\n )}\n >\n <h2 className=\"crow-font-semibold crow-text-gray-900\">{title}</h2>\n\n <div className=\"crow-flex crow-items-center crow-gap-2\">\n {showNewChat && onNewChat && (\n <button\n onClick={onNewChat}\n className=\"crow-p-1.5 crow-rounded-lg crow-text-gray-500 hover:crow-bg-gray-100 hover:crow-text-gray-700 crow-transition-colors\"\n aria-label=\"New chat\"\n >\n <svg\n className=\"crow-w-5 crow-h-5\"\n fill=\"none\"\n stroke=\"currentColor\"\n viewBox=\"0 0 24 24\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M12 4v16m8-8H4\"\n />\n </svg>\n </button>\n )}\n\n {showClose && onClose && (\n <button\n onClick={onClose}\n className=\"crow-p-1.5 crow-rounded-lg crow-text-gray-500 hover:crow-bg-gray-100 hover:crow-text-gray-700 crow-transition-colors\"\n aria-label=\"Close\"\n >\n <svg\n className=\"crow-w-5 crow-h-5\"\n fill=\"none\"\n stroke=\"currentColor\"\n viewBox=\"0 0 24 24\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M6 18L18 6M6 6l12 12\"\n />\n </svg>\n </button>\n )}\n </div>\n </div>\n );\n}\n\n","/**\n * MessageBubble - Single message display component\n */\n\nimport type { Message } from '@usecrow/client';\nimport { clsx } from 'clsx';\n\ninterface MessageBubbleProps {\n message: Message;\n isStreaming?: boolean;\n}\n\nfunction formatTime(date: Date): string {\n return date.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });\n}\n\nexport function MessageBubble({ message, isStreaming = false }: MessageBubbleProps) {\n const isUser = message.role === 'user';\n const isWaiting = !message.content && !isUser;\n\n return (\n <div\n className={clsx(\n 'crow-flex crow-flex-col',\n isUser ? 'crow-items-end' : 'crow-items-start'\n )}\n >\n {/* Thinking indicator */}\n {message.thinking && (\n <div className=\"crow-mb-2 crow-text-xs crow-text-gray-500 crow-bg-gray-100 crow-rounded-lg crow-px-3 crow-py-2 crow-max-w-[80%]\">\n <details open={!message.thinkingComplete}>\n <summary className=\"crow-cursor-pointer crow-font-medium\">\n {message.thinkingComplete ? 'Reasoning' : 'Thinking...'}\n </summary>\n <div className=\"crow-mt-1 crow-text-gray-600 crow-whitespace-pre-wrap\">\n {message.thinking}\n </div>\n </details>\n </div>\n )}\n\n {/* Waiting indicator */}\n {isWaiting && (\n <div className=\"crow-flex crow-items-center crow-gap-1 crow-text-gray-500 crow-text-sm crow-px-3 crow-py-2\">\n <span className=\"crow-animate-pulse\">●</span>\n <span className=\"crow-animate-pulse crow-animation-delay-100\">●</span>\n <span className=\"crow-animate-pulse crow-animation-delay-200\">●</span>\n </div>\n )}\n\n {/* Message content */}\n {message.content && (\n <div\n className={clsx(\n 'crow-max-w-[80%] crow-rounded-2xl crow-px-4 crow-py-2 crow-transition-all',\n isUser\n ? 'crow-bg-crow-primary crow-text-white'\n : 'crow-bg-gray-100 crow-text-gray-900'\n )}\n >\n <div className=\"crow-text-sm crow-whitespace-pre-wrap\">\n {message.content}\n {isStreaming && (\n <span className=\"crow-inline-block crow-w-1 crow-h-4 crow-ml-0.5 crow-bg-current crow-animate-pulse\" />\n )}\n </div>\n <div className=\"crow-text-xs crow-opacity-60 crow-mt-1\">\n {formatTime(message.timestamp)}\n </div>\n </div>\n )}\n\n {/* Citations */}\n {message.citations && message.citations.length > 0 && (\n <div className=\"crow-mt-1 crow-flex crow-flex-wrap crow-gap-1\">\n {message.citations.map((citation, idx) => (\n <span\n key={idx}\n className=\"crow-text-xs crow-bg-blue-100 crow-text-blue-700 crow-px-2 crow-py-0.5 crow-rounded\"\n >\n {citation.filename}\n </span>\n ))}\n </div>\n )}\n </div>\n );\n}\n\n","/**\n * MessageList - Scrollable list of messages\n */\n\nimport { useRef, useEffect } from 'react';\nimport type { Message } from '@usecrow/client';\nimport { MessageBubble } from './MessageBubble';\n\ninterface MessageListProps {\n messages: Message[];\n isLoading?: boolean;\n className?: string;\n}\n\nexport function MessageList({ messages, isLoading = false, className }: MessageListProps) {\n const containerRef = useRef<HTMLDivElement>(null);\n\n // Auto-scroll to bottom when new messages arrive\n useEffect(() => {\n if (containerRef.current) {\n containerRef.current.scrollTop = containerRef.current.scrollHeight;\n }\n }, [messages]);\n\n return (\n <div\n ref={containerRef}\n className={`crow-flex-1 crow-overflow-y-auto crow-px-4 crow-py-4 crow-space-y-3 ${className || ''}`}\n >\n {messages.map((message, index) => {\n const isLastBotMessage =\n message.role === 'assistant' && index === messages.length - 1;\n return (\n <MessageBubble\n key={message.id}\n message={message}\n isStreaming={isLastBotMessage && isLoading}\n />\n );\n })}\n </div>\n );\n}\n\n","/**\n * PromptInput - Chat input component with send/stop button\n */\n\nimport { useState, useRef, useEffect, useCallback } from 'react';\nimport { clsx } from 'clsx';\n\ninterface PromptInputProps {\n onSend: (message: string) => void;\n onStop?: () => void;\n isLoading?: boolean;\n placeholder?: string;\n disabled?: boolean;\n className?: string;\n}\n\nexport function PromptInput({\n onSend,\n onStop,\n isLoading = false,\n placeholder = 'Type your message...',\n disabled = false,\n className,\n}: PromptInputProps) {\n const [value, setValue] = useState('');\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n\n // Auto-resize textarea\n useEffect(() => {\n const textarea = textareaRef.current;\n if (textarea) {\n textarea.style.height = 'auto';\n textarea.style.height = `${Math.min(textarea.scrollHeight, 200)}px`;\n }\n }, [value]);\n\n const handleSubmit = useCallback(() => {\n if (value.trim() && !isLoading) {\n onSend(value.trim());\n setValue('');\n }\n }, [value, isLoading, onSend]);\n\n const handleKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault();\n handleSubmit();\n }\n },\n [handleSubmit]\n );\n\n const hasContent = value.trim().length > 0;\n\n return (\n <div\n className={clsx(\n 'crow-flex crow-items-end crow-gap-2 crow-p-3 crow-border-t crow-border-gray-200 crow-bg-white',\n className\n )}\n >\n <textarea\n ref={textareaRef}\n value={value}\n onChange={(e) => setValue(e.target.value)}\n onKeyDown={handleKeyDown}\n placeholder={placeholder}\n disabled={disabled || isLoading}\n rows={1}\n className={clsx(\n 'crow-flex-1 crow-resize-none crow-border crow-border-gray-300 crow-rounded-xl crow-px-4 crow-py-2',\n 'crow-text-sm crow-text-gray-900 crow-placeholder-gray-500',\n 'focus:crow-outline-none focus:crow-ring-2 focus:crow-ring-crow-primary focus:crow-border-transparent',\n 'disabled:crow-bg-gray-50 disabled:crow-cursor-not-allowed'\n )}\n />\n\n <button\n onClick={isLoading ? onStop : handleSubmit}\n disabled={!isLoading && !hasContent}\n className={clsx(\n 'crow-flex-shrink-0 crow-w-10 crow-h-10 crow-rounded-full crow-flex crow-items-center crow-justify-center',\n 'crow-transition-all crow-duration-200',\n isLoading\n ? 'crow-bg-red-500 hover:crow-bg-red-600 crow-text-white'\n : hasContent\n ? 'crow-bg-crow-primary hover:crow-bg-crow-primary-dark crow-text-white'\n : 'crow-bg-gray-200 crow-text-gray-400 crow-cursor-not-allowed'\n )}\n aria-label={isLoading ? 'Stop generation' : 'Send message'}\n >\n {isLoading ? (\n <svg className=\"crow-w-4 crow-h-4\" fill=\"currentColor\" viewBox=\"0 0 16 16\">\n <rect width=\"10\" height=\"10\" x=\"3\" y=\"3\" rx=\"1\" />\n </svg>\n ) : (\n <svg className=\"crow-w-4 crow-h-4\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} d=\"M5 12h14M12 5l7 7-7 7\" />\n </svg>\n )}\n </button>\n </div>\n );\n}\n\n","/**\n * CrowWidget - Floating chat widget (bottom-right bubble)\n *\n * This component can work standalone (creates its own client) or\n * be used within a CrowProvider (shares client with other components).\n */\n\nimport { useState, useRef, useEffect } from 'react';\nimport { CrowClient, type CrowClientConfig, type IdentifyOptions, type ToolHandlers } from '@usecrow/client';\nimport { useCrowClientOptional } from './CrowProvider';\nimport { useChat } from './hooks/useChat';\nimport { ChatBubble } from './components/ChatBubble';\nimport { WidgetHeader } from './components/WidgetHeader';\nimport { MessageList } from './components/MessageList';\nimport { PromptInput } from './components/PromptInput';\nimport { clsx } from 'clsx';\n\nexport interface CrowWidgetProps extends CrowClientConfig {\n /** Agent name shown in header */\n agentName?: string;\n /** Initial collapsed state */\n defaultCollapsed?: boolean;\n /** Callback when user needs to be identified */\n onIdentify?: (identify: (options: IdentifyOptions) => void) => void;\n /** Client-side tool handlers */\n tools?: ToolHandlers;\n /** Custom class name for the widget container */\n className?: string;\n /** Z-index for the widget (default: 999999) */\n zIndex?: number;\n}\n\nexport function CrowWidget({\n productId,\n apiUrl,\n model,\n agentName = 'Assistant',\n defaultCollapsed = true,\n onIdentify,\n tools,\n className,\n zIndex = 999999,\n}: CrowWidgetProps) {\n // Try to get client from context, or create standalone\n const contextClient = useCrowClientOptional();\n const standaloneClientRef = useRef<CrowClient | null>(null);\n\n // Create standalone client if not in provider\n if (!contextClient && !standaloneClientRef.current) {\n standaloneClientRef.current = new CrowClient({ productId, apiUrl, model });\n }\n\n const client = contextClient || standaloneClientRef.current!;\n\n // Clean up standalone client on unmount\n useEffect(() => {\n return () => {\n if (standaloneClientRef.current) {\n standaloneClientRef.current.destroy();\n }\n };\n }, []);\n\n // Register tools\n useEffect(() => {\n if (tools) {\n client.registerTools(tools);\n }\n }, [client, tools]);\n\n // Provide identify callback\n useEffect(() => {\n if (onIdentify) {\n onIdentify((options) => client.identify(options));\n }\n }, [client, onIdentify]);\n\n // UI state\n const [isCollapsed, setIsCollapsed] = useState(defaultCollapsed);\n\n // Chat hook\n const { messages, isLoading, sendMessage, stop, clearMessages } = useChat({\n client,\n });\n\n return (\n <>\n {/* Floating bubble button */}\n <ChatBubble isOpen={!isCollapsed} onClick={() => setIsCollapsed(!isCollapsed)} />\n\n {/* Widget panel */}\n {!isCollapsed && (\n <div\n className={clsx(\n 'crow-fixed crow-flex crow-flex-col',\n 'crow-bg-white crow-rounded-2xl crow-shadow-2xl',\n 'crow-border crow-border-gray-200',\n 'crow-overflow-hidden crow-animate-fade-in',\n className\n )}\n style={{\n zIndex,\n right: '20px',\n bottom: '90px',\n width: '380px',\n height: '550px',\n maxHeight: 'calc(100vh - 120px)',\n }}\n >\n {/* Header */}\n <WidgetHeader\n title={agentName}\n onNewChat={clearMessages}\n showNewChat={true}\n />\n\n {/* Messages */}\n <MessageList\n messages={messages}\n isLoading={isLoading}\n className=\"crow-flex-1\"\n />\n\n {/* Input */}\n <PromptInput\n onSend={sendMessage}\n onStop={stop}\n isLoading={isLoading}\n placeholder=\"Type your message...\"\n />\n </div>\n )}\n </>\n );\n}\n\n","/**\n * CrowCopilot - Sidebar chat panel\n *\n * Unlike CrowWidget, this component is designed to be mounted into\n * a user-provided container and works best with CrowProvider.\n */\n\nimport { useRef, useEffect } from 'react';\nimport { CrowClient, type CrowClientConfig, type IdentifyOptions, type ToolHandlers } from '@usecrow/client';\nimport { useCrowClientOptional } from './CrowProvider';\nimport { useChat } from './hooks/useChat';\nimport { WidgetHeader } from './components/WidgetHeader';\nimport { MessageList } from './components/MessageList';\nimport { PromptInput } from './components/PromptInput';\nimport { clsx } from 'clsx';\n\nexport interface CrowCopilotProps extends Partial<CrowClientConfig> {\n /** Title shown in header */\n title?: string;\n /** Position of the sidebar */\n position?: 'left' | 'right';\n /** Width of the sidebar */\n width?: number | string;\n /** Show close button */\n showClose?: boolean;\n /** Callback when close is clicked */\n onClose?: () => void;\n /** Callback when user needs to be identified */\n onIdentify?: (identify: (options: IdentifyOptions) => void) => void;\n /** Client-side tool handlers */\n tools?: ToolHandlers;\n /** Custom class name */\n className?: string;\n}\n\nexport function CrowCopilot({\n productId,\n apiUrl,\n model,\n title = 'Copilot',\n position = 'right',\n width = 400,\n showClose = false,\n onClose,\n onIdentify,\n tools,\n className,\n}: CrowCopilotProps) {\n // Try to get client from context, or create standalone if config provided\n const contextClient = useCrowClientOptional();\n const standaloneClientRef = useRef<CrowClient | null>(null);\n\n // Create standalone client if not in provider AND productId is provided\n if (!contextClient && !standaloneClientRef.current && productId) {\n standaloneClientRef.current = new CrowClient({ productId, apiUrl, model });\n }\n\n const client = contextClient || standaloneClientRef.current;\n\n if (!client) {\n console.error(\n '[CrowCopilot] No client available. Either wrap in CrowProvider or provide productId prop.'\n );\n return null;\n }\n\n // Clean up standalone client on unmount\n useEffect(() => {\n return () => {\n if (standaloneClientRef.current) {\n standaloneClientRef.current.destroy();\n }\n };\n }, []);\n\n // Register tools\n useEffect(() => {\n if (tools) {\n client.registerTools(tools);\n }\n }, [client, tools]);\n\n // Provide identify callback\n useEffect(() => {\n if (onIdentify) {\n onIdentify((options) => client.identify(options));\n }\n }, [client, onIdentify]);\n\n // Chat hook\n const { messages, isLoading, sendMessage, stop, clearMessages } = useChat({\n client,\n });\n\n const widthStyle = typeof width === 'number' ? `${width}px` : width;\n\n return (\n <div\n className={clsx(\n 'crow-flex crow-flex-col crow-h-full',\n 'crow-bg-white crow-border-gray-200',\n position === 'left' ? 'crow-border-r' : 'crow-border-l',\n className\n )}\n style={{ width: widthStyle }}\n >\n {/* Header */}\n <WidgetHeader\n title={title}\n onNewChat={clearMessages}\n onClose={onClose}\n showNewChat={true}\n showClose={showClose}\n />\n\n {/* Messages */}\n <MessageList\n messages={messages}\n isLoading={isLoading}\n className=\"crow-flex-1\"\n />\n\n {/* Input */}\n <PromptInput\n onSend={sendMessage}\n onStop={stop}\n isLoading={isLoading}\n placeholder=\"Ask anything...\"\n />\n </div>\n );\n}\n\n","/**\n * useIdentity - React hook for identity management\n */\n\nimport { useState, useCallback, useEffect } from 'react';\nimport { CrowClient, type IdentifyOptions } from '@usecrow/client';\n\ninterface UseIdentityOptions {\n client: CrowClient;\n}\n\ninterface UseIdentityReturn {\n isIdentified: boolean;\n isVerified: boolean;\n identify: (options: IdentifyOptions) => void;\n resetUser: () => void;\n}\n\n/**\n * React hook for managing user identity\n */\nexport function useIdentity({ client }: UseIdentityOptions): UseIdentityReturn {\n const [isIdentified, setIsIdentified] = useState(client.isIdentified());\n const [isVerified, setIsVerified] = useState(client.isVerified());\n\n useEffect(() => {\n // Set up callback for verification status\n client.on({\n onVerificationStatus: (verified) => {\n setIsVerified(verified);\n },\n });\n\n // Sync initial state\n setIsIdentified(client.isIdentified());\n setIsVerified(client.isVerified());\n }, [client]);\n\n const identify = useCallback(\n (options: IdentifyOptions) => {\n client.identify(options);\n setIsIdentified(true);\n },\n [client]\n );\n\n const resetUser = useCallback(() => {\n client.resetUser();\n setIsIdentified(false);\n setIsVerified(false);\n }, [client]);\n\n return {\n isIdentified,\n isVerified,\n identify,\n resetUser,\n };\n}\n\n","/**\n * useConversations - React hook for conversation management\n */\n\nimport { useState, useCallback } from 'react';\nimport { CrowClient, type Conversation, type Message } from '@usecrow/client';\n\ninterface UseConversationsOptions {\n client: CrowClient;\n}\n\ninterface UseConversationsReturn {\n conversations: Conversation[];\n isLoadingConversations: boolean;\n isLoadingHistory: boolean;\n currentConversationId: string | null;\n loadConversations: () => Promise<void>;\n loadHistory: (conversationId: string) => Promise<Message[]>;\n switchConversation: (conversationId: string) => Promise<void>;\n startNewConversation: () => void;\n}\n\n/**\n * React hook for managing conversations\n */\nexport function useConversations({\n client,\n}: UseConversationsOptions): UseConversationsReturn {\n const [conversations, setConversations] = useState<Conversation[]>([]);\n const [isLoadingConversations, setIsLoadingConversations] = useState(false);\n const [isLoadingHistory, setIsLoadingHistory] = useState(false);\n\n const loadConversations = useCallback(async () => {\n setIsLoadingConversations(true);\n try {\n const convs = await client.getConversations();\n setConversations(convs);\n } finally {\n setIsLoadingConversations(false);\n }\n }, [client]);\n\n const loadHistory = useCallback(\n async (conversationId: string): Promise<Message[]> => {\n setIsLoadingHistory(true);\n try {\n return await client.loadHistory(conversationId);\n } finally {\n setIsLoadingHistory(false);\n }\n },\n [client]\n );\n\n const switchConversation = useCallback(\n async (conversationId: string) => {\n setIsLoadingHistory(true);\n try {\n await client.switchConversation(conversationId);\n } finally {\n setIsLoadingHistory(false);\n }\n },\n [client]\n );\n\n const startNewConversation = useCallback(() => {\n client.clearMessages();\n }, [client]);\n\n return {\n conversations,\n isLoadingConversations,\n isLoadingHistory,\n currentConversationId: client.conversationId,\n loadConversations,\n loadHistory,\n switchConversation,\n startNewConversation,\n };\n}\n\n"]}
@@ -0,0 +1,166 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { CrowClientConfig, IdentifyOptions, ToolHandlers, CrowClient, StreamEvent, Message, Conversation } from '@usecrow/client';
3
+ export { ActiveWorkflow, Citation, ContextData, Conversation, CrowClientConfig, IdentifyOptions, Message, StreamEvent, ToolHandler, ToolHandlers, ToolResult, WorkflowTodo } from '@usecrow/client';
4
+
5
+ interface CrowWidgetProps extends CrowClientConfig {
6
+ /** Agent name shown in header */
7
+ agentName?: string;
8
+ /** Initial collapsed state */
9
+ defaultCollapsed?: boolean;
10
+ /** Callback when user needs to be identified */
11
+ onIdentify?: (identify: (options: IdentifyOptions) => void) => void;
12
+ /** Client-side tool handlers */
13
+ tools?: ToolHandlers;
14
+ /** Custom class name for the widget container */
15
+ className?: string;
16
+ /** Z-index for the widget (default: 999999) */
17
+ zIndex?: number;
18
+ }
19
+ declare function CrowWidget({ productId, apiUrl, model, agentName, defaultCollapsed, onIdentify, tools, className, zIndex, }: CrowWidgetProps): react_jsx_runtime.JSX.Element;
20
+
21
+ interface CrowCopilotProps extends Partial<CrowClientConfig> {
22
+ /** Title shown in header */
23
+ title?: string;
24
+ /** Position of the sidebar */
25
+ position?: 'left' | 'right';
26
+ /** Width of the sidebar */
27
+ width?: number | string;
28
+ /** Show close button */
29
+ showClose?: boolean;
30
+ /** Callback when close is clicked */
31
+ onClose?: () => void;
32
+ /** Callback when user needs to be identified */
33
+ onIdentify?: (identify: (options: IdentifyOptions) => void) => void;
34
+ /** Client-side tool handlers */
35
+ tools?: ToolHandlers;
36
+ /** Custom class name */
37
+ className?: string;
38
+ }
39
+ declare function CrowCopilot({ productId, apiUrl, model, title, position, width, showClose, onClose, onIdentify, tools, className, }: CrowCopilotProps): react_jsx_runtime.JSX.Element | null;
40
+
41
+ interface CrowProviderProps extends CrowClientConfig {
42
+ children: React.ReactNode;
43
+ }
44
+ /**
45
+ * Provider component that creates and shares a CrowClient instance
46
+ */
47
+ declare function CrowProvider({ children, productId, apiUrl, model, }: CrowProviderProps): react_jsx_runtime.JSX.Element;
48
+ /**
49
+ * Hook to access the CrowClient from context
50
+ */
51
+ declare function useCrowClient(): CrowClient;
52
+ /**
53
+ * Hook to optionally access the CrowClient (returns null if not in provider)
54
+ */
55
+ declare function useCrowClientOptional(): CrowClient | null;
56
+
57
+ /**
58
+ * useChat - React hook for chat functionality
59
+ */
60
+
61
+ interface UseChatOptions {
62
+ client: CrowClient;
63
+ onStreamEvent?: (event: StreamEvent) => void;
64
+ }
65
+ interface UseChatReturn {
66
+ messages: Message[];
67
+ isLoading: boolean;
68
+ sendMessage: (content: string) => Promise<void>;
69
+ stop: () => void;
70
+ clearMessages: () => void;
71
+ }
72
+ /**
73
+ * React hook that wraps CrowClient chat functionality
74
+ */
75
+ declare function useChat({ client, onStreamEvent }: UseChatOptions): UseChatReturn;
76
+
77
+ /**
78
+ * useIdentity - React hook for identity management
79
+ */
80
+
81
+ interface UseIdentityOptions {
82
+ client: CrowClient;
83
+ }
84
+ interface UseIdentityReturn {
85
+ isIdentified: boolean;
86
+ isVerified: boolean;
87
+ identify: (options: IdentifyOptions) => void;
88
+ resetUser: () => void;
89
+ }
90
+ /**
91
+ * React hook for managing user identity
92
+ */
93
+ declare function useIdentity({ client }: UseIdentityOptions): UseIdentityReturn;
94
+
95
+ /**
96
+ * useConversations - React hook for conversation management
97
+ */
98
+
99
+ interface UseConversationsOptions {
100
+ client: CrowClient;
101
+ }
102
+ interface UseConversationsReturn {
103
+ conversations: Conversation[];
104
+ isLoadingConversations: boolean;
105
+ isLoadingHistory: boolean;
106
+ currentConversationId: string | null;
107
+ loadConversations: () => Promise<void>;
108
+ loadHistory: (conversationId: string) => Promise<Message[]>;
109
+ switchConversation: (conversationId: string) => Promise<void>;
110
+ startNewConversation: () => void;
111
+ }
112
+ /**
113
+ * React hook for managing conversations
114
+ */
115
+ declare function useConversations({ client, }: UseConversationsOptions): UseConversationsReturn;
116
+
117
+ interface MessageBubbleProps {
118
+ message: Message;
119
+ isStreaming?: boolean;
120
+ }
121
+ declare function MessageBubble({ message, isStreaming }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
122
+
123
+ interface MessageListProps {
124
+ messages: Message[];
125
+ isLoading?: boolean;
126
+ className?: string;
127
+ }
128
+ declare function MessageList({ messages, isLoading, className }: MessageListProps): react_jsx_runtime.JSX.Element;
129
+
130
+ /**
131
+ * PromptInput - Chat input component with send/stop button
132
+ */
133
+ interface PromptInputProps {
134
+ onSend: (message: string) => void;
135
+ onStop?: () => void;
136
+ isLoading?: boolean;
137
+ placeholder?: string;
138
+ disabled?: boolean;
139
+ className?: string;
140
+ }
141
+ declare function PromptInput({ onSend, onStop, isLoading, placeholder, disabled, className, }: PromptInputProps): react_jsx_runtime.JSX.Element;
142
+
143
+ /**
144
+ * ChatBubble - Floating action button to open/close widget
145
+ */
146
+ interface ChatBubbleProps {
147
+ isOpen: boolean;
148
+ onClick: () => void;
149
+ className?: string;
150
+ }
151
+ declare function ChatBubble({ isOpen, onClick, className }: ChatBubbleProps): react_jsx_runtime.JSX.Element;
152
+
153
+ /**
154
+ * WidgetHeader - Header bar for widget/copilot
155
+ */
156
+ interface WidgetHeaderProps {
157
+ title?: string;
158
+ onNewChat?: () => void;
159
+ onClose?: () => void;
160
+ showNewChat?: boolean;
161
+ showClose?: boolean;
162
+ className?: string;
163
+ }
164
+ declare function WidgetHeader({ title, onNewChat, onClose, showNewChat, showClose, className, }: WidgetHeaderProps): react_jsx_runtime.JSX.Element;
165
+
166
+ export { ChatBubble, CrowCopilot, type CrowCopilotProps, CrowProvider, type CrowProviderProps, CrowWidget, type CrowWidgetProps, MessageBubble, MessageList, PromptInput, WidgetHeader, useChat, useConversations, useCrowClient, useCrowClientOptional, useIdentity };
@@ -0,0 +1,166 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { CrowClientConfig, IdentifyOptions, ToolHandlers, CrowClient, StreamEvent, Message, Conversation } from '@usecrow/client';
3
+ export { ActiveWorkflow, Citation, ContextData, Conversation, CrowClientConfig, IdentifyOptions, Message, StreamEvent, ToolHandler, ToolHandlers, ToolResult, WorkflowTodo } from '@usecrow/client';
4
+
5
+ interface CrowWidgetProps extends CrowClientConfig {
6
+ /** Agent name shown in header */
7
+ agentName?: string;
8
+ /** Initial collapsed state */
9
+ defaultCollapsed?: boolean;
10
+ /** Callback when user needs to be identified */
11
+ onIdentify?: (identify: (options: IdentifyOptions) => void) => void;
12
+ /** Client-side tool handlers */
13
+ tools?: ToolHandlers;
14
+ /** Custom class name for the widget container */
15
+ className?: string;
16
+ /** Z-index for the widget (default: 999999) */
17
+ zIndex?: number;
18
+ }
19
+ declare function CrowWidget({ productId, apiUrl, model, agentName, defaultCollapsed, onIdentify, tools, className, zIndex, }: CrowWidgetProps): react_jsx_runtime.JSX.Element;
20
+
21
+ interface CrowCopilotProps extends Partial<CrowClientConfig> {
22
+ /** Title shown in header */
23
+ title?: string;
24
+ /** Position of the sidebar */
25
+ position?: 'left' | 'right';
26
+ /** Width of the sidebar */
27
+ width?: number | string;
28
+ /** Show close button */
29
+ showClose?: boolean;
30
+ /** Callback when close is clicked */
31
+ onClose?: () => void;
32
+ /** Callback when user needs to be identified */
33
+ onIdentify?: (identify: (options: IdentifyOptions) => void) => void;
34
+ /** Client-side tool handlers */
35
+ tools?: ToolHandlers;
36
+ /** Custom class name */
37
+ className?: string;
38
+ }
39
+ declare function CrowCopilot({ productId, apiUrl, model, title, position, width, showClose, onClose, onIdentify, tools, className, }: CrowCopilotProps): react_jsx_runtime.JSX.Element | null;
40
+
41
+ interface CrowProviderProps extends CrowClientConfig {
42
+ children: React.ReactNode;
43
+ }
44
+ /**
45
+ * Provider component that creates and shares a CrowClient instance
46
+ */
47
+ declare function CrowProvider({ children, productId, apiUrl, model, }: CrowProviderProps): react_jsx_runtime.JSX.Element;
48
+ /**
49
+ * Hook to access the CrowClient from context
50
+ */
51
+ declare function useCrowClient(): CrowClient;
52
+ /**
53
+ * Hook to optionally access the CrowClient (returns null if not in provider)
54
+ */
55
+ declare function useCrowClientOptional(): CrowClient | null;
56
+
57
+ /**
58
+ * useChat - React hook for chat functionality
59
+ */
60
+
61
+ interface UseChatOptions {
62
+ client: CrowClient;
63
+ onStreamEvent?: (event: StreamEvent) => void;
64
+ }
65
+ interface UseChatReturn {
66
+ messages: Message[];
67
+ isLoading: boolean;
68
+ sendMessage: (content: string) => Promise<void>;
69
+ stop: () => void;
70
+ clearMessages: () => void;
71
+ }
72
+ /**
73
+ * React hook that wraps CrowClient chat functionality
74
+ */
75
+ declare function useChat({ client, onStreamEvent }: UseChatOptions): UseChatReturn;
76
+
77
+ /**
78
+ * useIdentity - React hook for identity management
79
+ */
80
+
81
+ interface UseIdentityOptions {
82
+ client: CrowClient;
83
+ }
84
+ interface UseIdentityReturn {
85
+ isIdentified: boolean;
86
+ isVerified: boolean;
87
+ identify: (options: IdentifyOptions) => void;
88
+ resetUser: () => void;
89
+ }
90
+ /**
91
+ * React hook for managing user identity
92
+ */
93
+ declare function useIdentity({ client }: UseIdentityOptions): UseIdentityReturn;
94
+
95
+ /**
96
+ * useConversations - React hook for conversation management
97
+ */
98
+
99
+ interface UseConversationsOptions {
100
+ client: CrowClient;
101
+ }
102
+ interface UseConversationsReturn {
103
+ conversations: Conversation[];
104
+ isLoadingConversations: boolean;
105
+ isLoadingHistory: boolean;
106
+ currentConversationId: string | null;
107
+ loadConversations: () => Promise<void>;
108
+ loadHistory: (conversationId: string) => Promise<Message[]>;
109
+ switchConversation: (conversationId: string) => Promise<void>;
110
+ startNewConversation: () => void;
111
+ }
112
+ /**
113
+ * React hook for managing conversations
114
+ */
115
+ declare function useConversations({ client, }: UseConversationsOptions): UseConversationsReturn;
116
+
117
+ interface MessageBubbleProps {
118
+ message: Message;
119
+ isStreaming?: boolean;
120
+ }
121
+ declare function MessageBubble({ message, isStreaming }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
122
+
123
+ interface MessageListProps {
124
+ messages: Message[];
125
+ isLoading?: boolean;
126
+ className?: string;
127
+ }
128
+ declare function MessageList({ messages, isLoading, className }: MessageListProps): react_jsx_runtime.JSX.Element;
129
+
130
+ /**
131
+ * PromptInput - Chat input component with send/stop button
132
+ */
133
+ interface PromptInputProps {
134
+ onSend: (message: string) => void;
135
+ onStop?: () => void;
136
+ isLoading?: boolean;
137
+ placeholder?: string;
138
+ disabled?: boolean;
139
+ className?: string;
140
+ }
141
+ declare function PromptInput({ onSend, onStop, isLoading, placeholder, disabled, className, }: PromptInputProps): react_jsx_runtime.JSX.Element;
142
+
143
+ /**
144
+ * ChatBubble - Floating action button to open/close widget
145
+ */
146
+ interface ChatBubbleProps {
147
+ isOpen: boolean;
148
+ onClick: () => void;
149
+ className?: string;
150
+ }
151
+ declare function ChatBubble({ isOpen, onClick, className }: ChatBubbleProps): react_jsx_runtime.JSX.Element;
152
+
153
+ /**
154
+ * WidgetHeader - Header bar for widget/copilot
155
+ */
156
+ interface WidgetHeaderProps {
157
+ title?: string;
158
+ onNewChat?: () => void;
159
+ onClose?: () => void;
160
+ showNewChat?: boolean;
161
+ showClose?: boolean;
162
+ className?: string;
163
+ }
164
+ declare function WidgetHeader({ title, onNewChat, onClose, showNewChat, showClose, className, }: WidgetHeaderProps): react_jsx_runtime.JSX.Element;
165
+
166
+ export { ChatBubble, CrowCopilot, type CrowCopilotProps, CrowProvider, type CrowProviderProps, CrowWidget, type CrowWidgetProps, MessageBubble, MessageList, PromptInput, WidgetHeader, useChat, useConversations, useCrowClient, useCrowClientOptional, useIdentity };