@optilogic/chat 1.0.0-beta.1 → 1.0.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/agent-response/components/ActivityIndicators.tsx","../src/components/agent-response/utils.ts","../src/components/agent-response/components/MetadataRow.tsx","../src/components/agent-response/components/ThinkingSection.tsx","../src/components/agent-response/components/ActionBar.tsx","../src/components/agent-response/hooks/useThinkingTimer.ts","../src/components/agent-response/types.ts","../src/components/agent-response/hooks/useAgentResponseAccumulator.ts","../src/components/agent-response/AgentResponse.tsx"],"names":["React2","jsxs","jsx","cn","React3","React4","useState","useCallback","React5"],"mappings":";;;;;;;AAiCA,IAAM,kBAAA,GAA2B,KAAA,CAAA,UAAA;AAAA,EAC/B,CAAC,EAAE,SAAA,EAAW,SAAA,EAAW,QAAQ,SAAA,EAAW,GAAG,KAAA,EAAM,EAAG,GAAA,KAAQ;AAC9D,IAAA,MAAM,cAAA,GACJ,UAAU,MAAA,GAAS,CAAA,IAAK,UAAU,MAAA,GAAS,CAAA,IAAK,OAAO,MAAA,GAAS,CAAA;AAElE,IAAA,IAAI,CAAC,gBAAgB,OAAO,IAAA;AAE5B,IAAA,uBACE,IAAA,CAAC,SAAI,GAAA,EAAU,SAAA,EAAW,GAAG,yBAAA,EAA2B,SAAS,CAAA,EAAI,GAAG,KAAA,EAErE,QAAA,EAAA;AAAA,MAAA,SAAA,CAAU,MAAA,GAAS,CAAA,oBAClB,IAAA,CAAC,OAAA,EAAA,EACC,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,cAAA,EAAA,EAAe,SAAO,IAAA,EACrB,QAAA,kBAAA,IAAA;AAAA,UAAC,QAAA;AAAA,UAAA;AAAA,YACC,SAAA,EAAU,uFAAA;AAAA,YACV,OAAA,EAAS,CAAC,CAAA,KAAM,CAAA,CAAE,eAAA,EAAgB;AAAA,YAElC,QAAA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kBACV,WAAW,KAAA,CAAM,SAAA;AAAA,kBACjB,WAAW,KAAA,CAAM,SAAA;AAAA,kBACjB,QAAQ,KAAA,CAAM,MAAA;AAAA,kBACd,QAAQ,KAAA,CAAM,MAAA;AAAA,kBACd;AAAA;AAAA,eACF;AAAA,8BAGAA,GAAAA;AAAA,gBAAC,eAAA;AAAA,gBAAA;AAAA,kBACC,SAAS,KAAA,CAAM,QAAA;AAAA,kBACf,UAAA,EAAY;AAAA;AAAA;AACd,aAAA,EACF,CAAA;AAAA,YAID,KAAA,CAAM,4BACLA,GAAAA;AAAA,cAAC,KAAA;AAAA,cAAA;AAAA,gBACC,SAAA,EAAWC,EAAAA;AAAA,kBACT,iBAAA;AAAA,kBACA,eAAA,IAAmB;AAAA,iBACrB;AAAA,gBAEC,QAAA,EAAA,cAAA,GACC,cAAA,CAAe,KAAA,CAAM,QAAQ,CAAA,mBAE7BD,GAAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,qBAAA,EAAuB,QAAA,EAAA,KAAA,CAAM,QAAA,EAAS;AAAA;AAAA;AAE1D,WAAA,EAEJ,CAAA;AAAA,UAGC,iCACCA,GAAAA;AAAA,YAAC,SAAA;AAAA,YAAA;AAAA,cACC,UAAU,KAAA,CAAM,QAAA;AAAA,cAChB,SAAA,EAAW,kBAAA;AAAA,cACX,gBAAA;AAAA,cACA,QAAA;AAAA,cACA,gBAAA;AAAA,cACA;AAAA;AAAA;AACF;AAAA;AAAA,KAEJ;AAAA,EAEJ;AACF;AACA,aAAA,CAAc,WAAA,GAAc,eAAA","file":"index.js","sourcesContent":["/**\n * Activity Indicators Component\n *\n * Displays tool, knowledge, memory icons with counts and popovers\n */\n\nimport * as React from \"react\";\nimport { Wrench, Book, HardDrive } from \"lucide-react\";\nimport { cn, Popover, PopoverTrigger, PopoverContent } from \"@optilogic/core\";\nimport type { ToolCall, KnowledgeItem, MemoryItem } from \"../types\";\n\nexport interface ActivityIndicatorsProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Tool calls to display */\n toolCalls: ToolCall[];\n /** Knowledge items to display */\n knowledge: KnowledgeItem[];\n /** Memory items to display */\n memory: MemoryItem[];\n}\n\n/**\n * ActivityIndicators Component\n *\n * Displays icons with counts for tool calls, knowledge retrieval, and memory access.\n * Each icon has a popover showing details when clicked.\n *\n * @example\n * <ActivityIndicators\n * toolCalls={state.toolCalls}\n * knowledge={state.knowledge}\n * memory={state.memory}\n * />\n */\nconst ActivityIndicators = React.forwardRef<HTMLDivElement, ActivityIndicatorsProps>(\n ({ toolCalls, knowledge, memory, className, ...props }, ref) => {\n const hasAnyActivity =\n toolCalls.length > 0 || knowledge.length > 0 || memory.length > 0;\n\n if (!hasAnyActivity) return null;\n\n return (\n <div ref={ref} className={cn(\"flex items-center gap-2\", className)} {...props}>\n {/* Tool Calls */}\n {toolCalls.length > 0 && (\n <Popover>\n <PopoverTrigger asChild>\n <button\n className=\"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors\"\n onClick={(e) => e.stopPropagation()}\n >\n <Wrench className=\"w-3.5 h-3.5\" />\n <span className=\"text-xs\">{toolCalls.length}</span>\n </button>\n </PopoverTrigger>\n <PopoverContent className=\"w-80\">\n <div className=\"space-y-2\">\n <h4 className=\"font-medium text-sm\">Tool Calls</h4>\n <div className=\"space-y-2 max-h-60 overflow-auto\">\n {toolCalls.map((tool) => (\n <div key={tool.id} className=\"p-2 bg-muted rounded text-xs\">\n <div className=\"font-medium\">{tool.name}</div>\n {tool.arguments && (\n <pre className=\"mt-1 text-muted-foreground overflow-x-auto\">\n {JSON.stringify(tool.arguments, null, 2)}\n </pre>\n )}\n </div>\n ))}\n </div>\n </div>\n </PopoverContent>\n </Popover>\n )}\n\n {/* Knowledge */}\n {knowledge.length > 0 && (\n <Popover>\n <PopoverTrigger asChild>\n <button\n className=\"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors\"\n onClick={(e) => e.stopPropagation()}\n >\n <Book className=\"w-3.5 h-3.5\" />\n <span className=\"text-xs\">{knowledge.length}</span>\n </button>\n </PopoverTrigger>\n <PopoverContent className=\"w-80\">\n <div className=\"space-y-2\">\n <h4 className=\"font-medium text-sm\">Knowledge Retrieved</h4>\n <div className=\"space-y-2 max-h-60 overflow-auto\">\n {knowledge.map((item) => (\n <div key={item.id} className=\"p-2 bg-muted rounded text-xs\">\n <div className=\"font-medium\">{item.source}</div>\n <div className=\"mt-1 text-muted-foreground\">\n {item.content}\n </div>\n </div>\n ))}\n </div>\n </div>\n </PopoverContent>\n </Popover>\n )}\n\n {/* Memory */}\n {memory.length > 0 && (\n <Popover>\n <PopoverTrigger asChild>\n <button\n className=\"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors\"\n onClick={(e) => e.stopPropagation()}\n >\n <HardDrive className=\"w-3.5 h-3.5\" />\n <span className=\"text-xs\">{memory.length}</span>\n </button>\n </PopoverTrigger>\n <PopoverContent className=\"w-80\">\n <div className=\"space-y-2\">\n <h4 className=\"font-medium text-sm\">Memory Accessed</h4>\n <div className=\"space-y-2 max-h-60 overflow-auto\">\n {memory.map((item) => (\n <div key={item.id} className=\"p-2 bg-muted rounded text-xs\">\n <div className=\"font-medium\">{item.type}</div>\n <div className=\"mt-1 text-muted-foreground\">\n {item.content}\n </div>\n </div>\n ))}\n </div>\n </div>\n </PopoverContent>\n </Popover>\n )}\n </div>\n );\n }\n);\nActivityIndicators.displayName = \"ActivityIndicators\";\n\nexport { ActivityIndicators };\n","/**\n * Agent Response Utility Functions\n */\n\n/**\n * Format elapsed time for display\n * - Under 60s: \"Xs\" (e.g., \"23s\")\n * - 60+ seconds while active: \"M:SS\" (e.g., \"1:23\")\n * - Complete under 60s: \"Xs\" (e.g., \"45s\")\n * - Complete 60-119s: \"1.X min\" (e.g., \"1.2 min\")\n * - Complete 120+ s: \"X.X min\" (e.g., \"2.5 min\")\n */\nexport function formatTime(seconds: number, isComplete: boolean): string {\n if (seconds < 1) {\n return isComplete ? \"<1s\" : \"0s\";\n }\n\n if (isComplete) {\n // Completed state formatting\n if (seconds < 60) {\n return `${Math.round(seconds)}s`;\n }\n const minutes = seconds / 60;\n return `${minutes.toFixed(1)} min`;\n }\n\n // Active state formatting\n if (seconds < 60) {\n return `${Math.floor(seconds)}s`;\n }\n const mins = Math.floor(seconds / 60);\n const secs = Math.floor(seconds % 60);\n return `${mins}:${secs.toString().padStart(2, \"0\")}`;\n}\n\n/**\n * Format total time for action bar display\n */\nexport function formatTotalTime(seconds: number): string {\n if (seconds < 1) {\n return \"<1s\";\n }\n if (seconds < 60) {\n return `${seconds.toFixed(1)}s`;\n }\n const minutes = seconds / 60;\n return `${minutes.toFixed(1)}m`;\n}\n","/**\n * Metadata Row Component\n *\n * Displays thinking toggle, timer, and activity indicators\n */\n\nimport * as React from \"react\";\nimport { ChevronDown, ChevronUp } from \"lucide-react\";\nimport { cn, LoadingSpinner } from \"@optilogic/core\";\nimport { ActivityIndicators } from \"./ActivityIndicators\";\nimport { formatTime } from \"../utils\";\nimport type { AgentResponseStatus, ToolCall, KnowledgeItem, MemoryItem } from \"../types\";\n\nexport interface MetadataRowProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Whether there is thinking content */\n hasThinking: boolean;\n /** Whether the thinking section is expanded */\n isExpanded: boolean;\n /** Toggle callback for thinking expansion */\n onToggle: () => void;\n /** Tool calls to display */\n toolCalls: ToolCall[];\n /** Knowledge items to display */\n knowledge: KnowledgeItem[];\n /** Memory items to display */\n memory: MemoryItem[];\n /** Current response status */\n status: AgentResponseStatus;\n /** Elapsed time in seconds */\n elapsedTime: number;\n}\n\n/**\n * MetadataRow Component\n *\n * Displays the metadata row with thinking toggle, timer, and activity indicators.\n * When thinking content is present, the row is clickable to toggle expansion.\n *\n * @example\n * <MetadataRow\n * hasThinking={!!state.thinking}\n * isExpanded={thinkingExpanded}\n * onToggle={toggleThinking}\n * toolCalls={state.toolCalls}\n * knowledge={state.knowledge}\n * memory={state.memory}\n * status={state.status}\n * elapsedTime={elapsedTime}\n * />\n */\nconst MetadataRow = React.forwardRef<HTMLDivElement, MetadataRowProps>(\n (\n {\n hasThinking,\n isExpanded,\n onToggle,\n toolCalls,\n knowledge,\n memory,\n status,\n elapsedTime,\n className,\n ...props\n },\n ref\n ) => {\n const isProcessing = status === \"processing\";\n const isComplete = status === \"complete\";\n const hasActivity =\n toolCalls.length > 0 || knowledge.length > 0 || memory.length > 0;\n\n // Determine what to show on the left side\n const renderLeftContent = () => {\n // If we have thinking text, show collapse toggle + label + timer\n if (hasThinking) {\n return (\n <div className=\"flex items-center gap-1.5\">\n {isExpanded ? (\n <ChevronUp className=\"w-3.5 h-3.5 text-muted-foreground\" />\n ) : (\n <ChevronDown className=\"w-3.5 h-3.5 text-muted-foreground\" />\n )}\n <span className=\"text-xs text-muted-foreground\">\n {isComplete\n ? `Thought for ${formatTime(elapsedTime, true)}`\n : `Thinking... ${formatTime(elapsedTime, false)}`}\n </span>\n </div>\n );\n }\n\n // If processing but no thinking text yet, show spinner\n if (isProcessing) {\n return (\n <div className=\"flex items-center gap-1.5\">\n <LoadingSpinner size=\"sm\" variant=\"muted\" className=\"w-3.5 h-3.5\" />\n <span className=\"text-xs text-muted-foreground\">Processing</span>\n </div>\n );\n }\n\n // Complete with no thinking - show nothing on left (just activity on right)\n return null;\n };\n\n const leftContent = renderLeftContent();\n\n // If nothing to show (no thinking, not processing, no activity), hide the row\n if (!leftContent && !hasActivity) {\n return null;\n }\n\n // Always use a div for the row to avoid nesting buttons\n // When there's thinking, only the left side is clickable\n return (\n <div\n ref={ref}\n className={cn(\"w-full flex items-center justify-between px-3 py-2\", className)}\n {...props}\n >\n {/* Left content - clickable when there's thinking */}\n {hasThinking ? (\n <button\n onClick={onToggle}\n className=\"flex items-center gap-1.5 hover:bg-muted/50 -ml-1.5 pl-1.5 pr-2 py-0.5 rounded transition-colors\"\n >\n {leftContent}\n </button>\n ) : (\n <div className=\"flex items-center gap-1.5\">\n {leftContent}\n </div>\n )}\n <ActivityIndicators\n toolCalls={toolCalls}\n knowledge={knowledge}\n memory={memory}\n />\n </div>\n );\n }\n);\nMetadataRow.displayName = \"MetadataRow\";\n\nexport { MetadataRow };\n","/**\n * Thinking Section Component\n *\n * Collapsible section for displaying agent thinking/reasoning content\n */\n\nimport * as React from \"react\";\nimport { cn } from \"@optilogic/core\";\n\nexport interface ThinkingSectionProps extends React.HTMLAttributes<HTMLDivElement> {\n /** The thinking content to display */\n content: string;\n /** Whether the section is expanded */\n isExpanded: boolean;\n}\n\n/**\n * ThinkingSection Component\n *\n * Displays the agent's thinking/reasoning content in a collapsible panel.\n *\n * @example\n * <ThinkingSection content={state.thinking} isExpanded={isExpanded} />\n */\nconst ThinkingSection = React.forwardRef<HTMLDivElement, ThinkingSectionProps>(\n ({ content, isExpanded, className, ...props }, ref) => {\n if (!isExpanded || !content) {\n return null;\n }\n\n return (\n <div\n ref={ref}\n className={cn(\"px-3 pb-3 border-t border-border\", className)}\n {...props}\n >\n <div className=\"mt-2 max-h-[200px] overflow-y-auto\">\n <pre className=\"text-xs text-muted-foreground whitespace-pre-wrap font-mono\">\n {content}\n </pre>\n </div>\n </div>\n );\n }\n);\nThinkingSection.displayName = \"ThinkingSection\";\n\nexport { ThinkingSection };\n","/**\n * Action Bar Component\n *\n * Displays copy, feedback, and timing actions for the response\n */\n\nimport * as React from \"react\";\nimport { useState, useCallback } from \"react\";\nimport { Copy, Check, ThumbsUp, ThumbsDown } from \"lucide-react\";\nimport { cn } from \"@optilogic/core\";\nimport { formatTotalTime } from \"../utils\";\nimport type { FeedbackValue } from \"../types\";\n\nexport interface ActionBarProps extends React.HTMLAttributes<HTMLDivElement> {\n /** The response text (for copying) */\n response: string;\n /** Whether the action bar is visible */\n isVisible: boolean;\n /** Total time in seconds */\n totalTimeSeconds: number;\n /** Current feedback value */\n feedback?: FeedbackValue;\n /** Callback when feedback changes */\n onFeedbackChange?: (feedback: FeedbackValue) => void;\n /** Callback when response is copied */\n onResponseCopy?: (response: string) => void;\n}\n\n/**\n * ActionBar Component\n *\n * Displays action buttons for copying the response, providing feedback,\n * and showing total response time.\n *\n * @example\n * <ActionBar\n * response={state.response}\n * isVisible={isHovered}\n * totalTimeSeconds={totalTime}\n * feedback={feedback}\n * onFeedbackChange={setFeedback}\n * onCopy={handleCopy}\n * />\n */\nconst ActionBar = React.forwardRef<HTMLDivElement, ActionBarProps>(\n (\n {\n response,\n isVisible,\n totalTimeSeconds,\n feedback,\n onFeedbackChange,\n onResponseCopy,\n className,\n ...props\n },\n ref\n ) => {\n const [copied, setCopied] = useState(false);\n\n const handleCopy = useCallback(async () => {\n try {\n await navigator.clipboard.writeText(response);\n setCopied(true);\n setTimeout(() => setCopied(false), 2000);\n onResponseCopy?.(response);\n } catch (err) {\n console.error(\"Failed to copy response:\", err);\n }\n }, [response, onResponseCopy]);\n\n const handleThumbsUp = useCallback(() => {\n const newValue = feedback === \"up\" ? null : \"up\";\n onFeedbackChange?.(newValue);\n }, [feedback, onFeedbackChange]);\n\n const handleThumbsDown = useCallback(() => {\n const newValue = feedback === \"down\" ? null : \"down\";\n onFeedbackChange?.(newValue);\n }, [feedback, onFeedbackChange]);\n\n const isThumbsUp = feedback === \"up\";\n const isThumbsDown = feedback === \"down\";\n\n return (\n <div\n ref={ref}\n className={cn(\n \"flex items-center justify-between px-4 py-2\",\n \"transition-opacity duration-200\",\n isVisible ? \"opacity-100\" : \"opacity-0 pointer-events-none\",\n className\n )}\n {...props}\n >\n {/* Left side - action buttons */}\n <div className=\"flex items-center gap-1\">\n {/* Copy button */}\n <button\n onClick={handleCopy}\n className=\"p-1.5 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground\"\n title={copied ? \"Copied!\" : \"Copy response\"}\n >\n {copied ? (\n <Check className=\"w-4 h-4 text-green-500\" />\n ) : (\n <Copy className=\"w-4 h-4\" />\n )}\n </button>\n\n {/* Thumbs up */}\n <button\n onClick={handleThumbsUp}\n className={cn(\n \"p-1.5 rounded hover:bg-muted transition-colors\",\n isThumbsUp\n ? \"text-green-500\"\n : \"text-muted-foreground hover:text-foreground\"\n )}\n title=\"Good response\"\n >\n <ThumbsUp className={cn(\"w-4 h-4\", isThumbsUp && \"fill-current\")} />\n </button>\n\n {/* Thumbs down */}\n <button\n onClick={handleThumbsDown}\n className={cn(\n \"p-1.5 rounded hover:bg-muted transition-colors\",\n isThumbsDown\n ? \"text-red-500\"\n : \"text-muted-foreground hover:text-foreground\"\n )}\n title=\"Poor response\"\n >\n <ThumbsDown className={cn(\"w-4 h-4\", isThumbsDown && \"fill-current\")} />\n </button>\n </div>\n\n {/* Right side - timing info */}\n <span className=\"text-xs text-muted-foreground\">\n Total time: {formatTotalTime(totalTimeSeconds)}\n </span>\n </div>\n );\n }\n);\nActionBar.displayName = \"ActionBar\";\n\nexport { ActionBar };\n","/**\n * useThinkingTimer Hook\n *\n * Tracks elapsed time during agent thinking/processing\n */\n\nimport { useState, useEffect } from \"react\";\nimport type { AgentResponseStatus } from \"../types\";\n\nexport interface UseThinkingTimerOptions {\n startTime: number | null;\n endTime: number | null;\n status: AgentResponseStatus;\n}\n\n/**\n * Custom hook for thinking timer\n * Returns elapsed time in seconds\n */\nexport function useThinkingTimer({\n startTime,\n endTime,\n status,\n}: UseThinkingTimerOptions): number {\n const [elapsed, setElapsed] = useState(0);\n\n useEffect(() => {\n if (!startTime) {\n setElapsed(0);\n return;\n }\n\n // If complete, calculate final elapsed time\n if (status === \"complete\" && endTime) {\n setElapsed((endTime - startTime) / 1000);\n return;\n }\n\n // If still processing, update every second\n if (status === \"processing\") {\n const updateElapsed = () => {\n setElapsed((Date.now() - startTime) / 1000);\n };\n\n updateElapsed(); // Initial update\n const interval = setInterval(updateElapsed, 1000);\n return () => clearInterval(interval);\n }\n }, [startTime, endTime, status]);\n\n return elapsed;\n}\n","/**\n * Agent Response Component Types\n *\n * Type definitions for the library-ready agent response component\n */\n\n/**\n * Status of the agent response cycle\n */\nexport type AgentResponseStatus = \"idle\" | \"processing\" | \"complete\";\n\n/**\n * Feedback value for the response\n */\nexport type FeedbackValue = \"up\" | \"down\" | null;\n\n/**\n * Tool call information from the agent\n */\nexport interface ToolCall {\n id: string;\n name: string;\n arguments?: Record<string, unknown>;\n timestamp: number;\n}\n\n/**\n * Knowledge retrieval information\n */\nexport interface KnowledgeItem {\n id: string;\n source: string;\n content: string;\n timestamp: number;\n}\n\n/**\n * Memory access information\n */\nexport interface MemoryItem {\n id: string;\n type: string;\n content: string;\n timestamp: number;\n}\n\n/**\n * State shape for the agent response component\n */\nexport interface AgentResponseState {\n /** Current status of the response cycle */\n status: AgentResponseStatus;\n /** Accumulated thinking/reasoning text */\n thinking: string;\n /** Tool calls made during processing */\n toolCalls: ToolCall[];\n /** Knowledge items retrieved */\n knowledge: KnowledgeItem[];\n /** Memory items accessed */\n memory: MemoryItem[];\n /** Final response text */\n response: string;\n /** Timestamp when first thinking message was received (for timer) */\n thinkingStartTime: number | null;\n /** Timestamp when response was completed (for final timer display) */\n responseCompleteTime: number | null;\n /** Timestamp when first message of any type was received (for total time) */\n firstMessageTime: number | null;\n}\n\n/**\n * WebSocket message payload for agent responses\n */\nexport interface AgentMessage {\n type: \"status\" | \"thinking\" | \"tool_call\" | \"knowledge\" | \"memory\" | \"response\";\n /** Message content - for simple string payloads */\n message?: string;\n /** Alternative content field */\n content?: string;\n /** For status messages */\n status?: string;\n /** For tool_call messages */\n tool?: {\n id: string;\n name: string;\n arguments?: Record<string, unknown>;\n };\n /** For knowledge messages */\n knowledge?: {\n id: string;\n source: string;\n content: string;\n };\n /** For memory messages */\n memory?: {\n id: string;\n type: string;\n content: string;\n };\n}\n\n/**\n * Generic websocket message wrapper type\n */\nexport interface GenericWebSocketMessage {\n topic: string;\n message: AgentMessage;\n accountId?: string;\n}\n\n/**\n * Initial state for the agent response component\n */\nexport const initialAgentResponseState: AgentResponseState = {\n status: \"idle\",\n thinking: \"\",\n toolCalls: [],\n knowledge: [],\n memory: [],\n response: \"\",\n thinkingStartTime: null,\n responseCompleteTime: null,\n firstMessageTime: null,\n};\n","/**\n * useAgentResponseAccumulator Hook\n *\n * Accumulates agent response messages into a unified state\n */\n\nimport { useState, useCallback } from \"react\";\nimport {\n initialAgentResponseState,\n type AgentResponseState,\n type AgentMessage,\n type GenericWebSocketMessage,\n type ToolCall,\n type KnowledgeItem,\n type MemoryItem,\n} from \"../types\";\n\nexport interface UseAgentResponseAccumulatorOptions {\n /** WebSocket topic to filter messages (optional, for convenience) */\n topic?: string;\n}\n\nexport interface UseAgentResponseAccumulatorReturn {\n /** Current accumulated state */\n state: AgentResponseState;\n\n /** Handler to process incoming messages */\n handleMessage: (message: unknown) => void;\n\n /** Reset state to initial */\n reset: () => void;\n}\n\n/**\n * Hook for accumulating agent response messages into a unified state\n *\n * @example\n * const { state, handleMessage, reset } = useAgentResponseAccumulator({ topic: \"agent\" });\n *\n * // In your WebSocket handler:\n * websocket.onmessage = (event) => {\n * handleMessage(JSON.parse(event.data));\n * };\n */\nexport function useAgentResponseAccumulator(\n options?: UseAgentResponseAccumulatorOptions\n): UseAgentResponseAccumulatorReturn {\n const [state, setState] = useState<AgentResponseState>(initialAgentResponseState);\n const topic = options?.topic;\n\n const handleMessage = useCallback(\n (message: unknown) => {\n // If topic filter is provided, check for matching topic\n let payload: AgentMessage;\n\n if (topic) {\n const msg = message as GenericWebSocketMessage;\n if (msg.topic !== topic) return;\n payload = msg.message;\n } else {\n // Assume message is the payload directly\n payload = message as AgentMessage;\n }\n\n setState((prev) => {\n // If we receive a non-status message while idle, transition to processing\n let newStatus = prev.status;\n const isFirstMessage = prev.status === \"idle\" && payload.type !== \"status\";\n if (isFirstMessage) {\n newStatus = \"processing\";\n }\n\n // Track first message time for total time calculation\n const firstMessageTime =\n prev.firstMessageTime ?? (isFirstMessage ? Date.now() : null);\n\n switch (payload.type) {\n case \"status\":\n // \"Harness connected\" resets to idle\n if (\n payload.message === \"Harness connected\" ||\n payload.status === \"Harness connected\"\n ) {\n return { ...initialAgentResponseState };\n }\n return { ...prev, status: newStatus };\n\n case \"thinking\": {\n const newThinking = payload.message || payload.content || \"\";\n // Add line break between thinking messages\n const separator = prev.thinking && newThinking ? \"\\n\\n\" : \"\";\n // Set thinkingStartTime on first thinking message\n const thinkingStartTime =\n prev.thinkingStartTime ?? (newThinking ? Date.now() : null);\n return {\n ...prev,\n status: newStatus,\n thinking: prev.thinking + separator + newThinking,\n thinkingStartTime,\n firstMessageTime,\n };\n }\n\n case \"tool_call\": {\n // Handle both formats: { message: \"ToolName\" } or { tool: { id, name, arguments } }\n const toolName = payload.message || payload.tool?.name;\n if (toolName) {\n const newToolCall: ToolCall = {\n id: payload.tool?.id || `tool-${Date.now()}`,\n name: toolName,\n arguments: payload.tool?.arguments,\n timestamp: Date.now(),\n };\n return {\n ...prev,\n status: newStatus,\n toolCalls: [...prev.toolCalls, newToolCall],\n firstMessageTime,\n };\n }\n return { ...prev, status: newStatus, firstMessageTime };\n }\n\n case \"knowledge\": {\n // Handle both formats: { message: \"content\" } or { knowledge: { id, source, content } }\n const knowledgeContent = payload.message || payload.knowledge?.content;\n if (knowledgeContent) {\n const newKnowledge: KnowledgeItem = {\n id: payload.knowledge?.id || `knowledge-${Date.now()}`,\n source: payload.knowledge?.source || \"unknown\",\n content: knowledgeContent,\n timestamp: Date.now(),\n };\n return {\n ...prev,\n status: newStatus,\n knowledge: [...prev.knowledge, newKnowledge],\n firstMessageTime,\n };\n }\n return { ...prev, status: newStatus, firstMessageTime };\n }\n\n case \"memory\": {\n // Handle both formats: { message: \"content\" } or { memory: { id, type, content } }\n const memoryContent = payload.message || payload.memory?.content;\n if (memoryContent) {\n const newMemory: MemoryItem = {\n id: payload.memory?.id || `memory-${Date.now()}`,\n type: payload.memory?.type || \"unknown\",\n content: memoryContent,\n timestamp: Date.now(),\n };\n return {\n ...prev,\n status: newStatus,\n memory: [...prev.memory, newMemory],\n firstMessageTime,\n };\n }\n return { ...prev, status: newStatus, firstMessageTime };\n }\n\n case \"response\":\n return {\n ...prev,\n status: \"complete\",\n response: payload.message || payload.content || \"\",\n responseCompleteTime: Date.now(),\n firstMessageTime: prev.firstMessageTime ?? Date.now(),\n };\n\n default:\n return { ...prev, status: newStatus, firstMessageTime };\n }\n });\n },\n [topic]\n );\n\n const reset = useCallback(() => {\n setState(initialAgentResponseState);\n }, []);\n\n return { state, handleMessage, reset };\n}\n","/**\n * AgentResponse Component\n *\n * A library-ready presentational component for displaying AI agent responses.\n * Displays thinking, tool calls, knowledge retrieval, memory access, and final response.\n */\n\nimport * as React from \"react\";\nimport { useState, useMemo, useCallback } from \"react\";\nimport { cn } from \"@optilogic/core\";\nimport { MetadataRow, ThinkingSection, ActionBar } from \"./components\";\nimport { useThinkingTimer } from \"./hooks\";\nimport type { AgentResponseState, FeedbackValue } from \"./types\";\n\nexport interface AgentResponseProps extends React.HTMLAttributes<HTMLDivElement> {\n /** The response state to render */\n state: AgentResponseState;\n\n /** Optional unique ID (for list keys) */\n id?: string;\n\n /** Optional timestamp to display */\n timestamp?: Date;\n\n /** Feedback state (controlled) */\n feedback?: FeedbackValue;\n onFeedbackChange?: (feedback: FeedbackValue) => void;\n\n /** Callback when the response is copied via the action bar */\n onResponseCopy?: (response: string) => void;\n\n /** Thinking section expansion (controlled or uncontrolled) */\n defaultThinkingExpanded?: boolean;\n thinkingExpanded?: boolean;\n onThinkingExpandedChange?: (expanded: boolean) => void;\n\n /** Action bar visibility mode */\n actionsVisible?: boolean | \"hover\";\n\n /**\n * Custom markdown renderer for the response content.\n * If not provided, the response will be rendered as plain text.\n *\n * @example\n * <AgentResponse\n * state={state}\n * renderMarkdown={(content) => <MyMarkdownRenderer content={content} />}\n * />\n */\n renderMarkdown?: (content: string) => React.ReactNode;\n}\n\n/**\n * AgentResponse Component\n *\n * A complete component for displaying AI agent responses including:\n * - Thinking/reasoning content (collapsible)\n * - Tool calls, knowledge retrieval, and memory access indicators\n * - Final response with optional markdown rendering\n * - Action bar with copy and feedback buttons\n *\n * @example\n * // Basic usage with useAgentResponseAccumulator hook\n * const { state, handleMessage } = useAgentResponseAccumulator();\n *\n * <AgentResponse state={state} />\n *\n * @example\n * // With markdown rendering and feedback\n * <AgentResponse\n * state={state}\n * renderMarkdown={(content) => <ReactMarkdown>{content}</ReactMarkdown>}\n * feedback={feedback}\n * onFeedbackChange={setFeedback}\n * />\n *\n * @example\n * // Controlled thinking expansion\n * <AgentResponse\n * state={state}\n * thinkingExpanded={isExpanded}\n * onThinkingExpandedChange={setIsExpanded}\n * />\n */\nconst AgentResponse = React.forwardRef<HTMLDivElement, AgentResponseProps>(\n (\n {\n state,\n id,\n timestamp,\n feedback,\n onFeedbackChange,\n onResponseCopy,\n defaultThinkingExpanded = false,\n thinkingExpanded: controlledThinkingExpanded,\n onThinkingExpandedChange,\n actionsVisible = \"hover\",\n renderMarkdown,\n className,\n ...props\n },\n ref\n ) => {\n // Uncontrolled thinking expanded state\n const [uncontrolledExpanded, setUncontrolledExpanded] = useState(defaultThinkingExpanded);\n\n // Determine if thinking is controlled\n const isThinkingControlled = controlledThinkingExpanded !== undefined;\n const thinkingExpanded = isThinkingControlled\n ? controlledThinkingExpanded\n : uncontrolledExpanded;\n\n // Toggle thinking handler\n const toggleThinking = useCallback(() => {\n const newValue = !thinkingExpanded;\n if (isThinkingControlled) {\n onThinkingExpandedChange?.(newValue);\n } else {\n setUncontrolledExpanded(newValue);\n }\n }, [thinkingExpanded, isThinkingControlled, onThinkingExpandedChange]);\n\n // Hover state for action bar visibility\n const [isHovered, setIsHovered] = useState(false);\n\n // Thinking timer\n const elapsedTime = useThinkingTimer({\n startTime: state.thinkingStartTime,\n endTime: state.responseCompleteTime,\n status: state.status,\n });\n\n // Calculate total time (from first message to response complete)\n const totalTimeSeconds = useMemo(() => {\n if (!state.firstMessageTime || !state.responseCompleteTime) return 0;\n return (state.responseCompleteTime - state.firstMessageTime) / 1000;\n }, [state.firstMessageTime, state.responseCompleteTime]);\n\n // Derived state: has any content been received?\n const hasAnyContent =\n state.thinking ||\n state.toolCalls.length > 0 ||\n state.knowledge.length > 0 ||\n state.memory.length > 0 ||\n state.response;\n\n // Derived state: should show metadata row?\n const showMetadataRow =\n state.thinking ||\n state.toolCalls.length > 0 ||\n state.knowledge.length > 0 ||\n state.memory.length > 0 ||\n state.status === \"processing\";\n\n // Determine action bar visibility\n const showActionBar = state.status === \"complete\" && state.response;\n const isActionBarVisible =\n actionsVisible === true ||\n (actionsVisible === \"hover\" && isHovered);\n\n // If no content, render nothing\n if (!hasAnyContent) {\n return null;\n }\n\n return (\n <div\n ref={ref}\n className={className}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n {...props}\n >\n {/* Message Content Container */}\n <div className=\"border border-border rounded-lg overflow-hidden\">\n {/* Metadata Row - show if there's any metadata or thinking */}\n {showMetadataRow && (\n <>\n <MetadataRow\n hasThinking={!!state.thinking}\n isExpanded={thinkingExpanded}\n onToggle={toggleThinking}\n toolCalls={state.toolCalls}\n knowledge={state.knowledge}\n memory={state.memory}\n status={state.status}\n elapsedTime={elapsedTime}\n />\n\n {/* Thinking Content - collapsible with max-height */}\n <ThinkingSection\n content={state.thinking}\n isExpanded={thinkingExpanded}\n />\n </>\n )}\n\n {/* Response Section */}\n {state.response && (\n <div\n className={cn(\n \"bg-muted/50 p-4\",\n showMetadataRow && \"border-t border-border\"\n )}\n >\n {renderMarkdown ? (\n renderMarkdown(state.response)\n ) : (\n <span className=\"whitespace-pre-wrap\">{state.response}</span>\n )}\n </div>\n )}\n </div>\n\n {/* Action Bar - outside the message container, visible on hover when complete */}\n {showActionBar && (\n <ActionBar\n response={state.response}\n isVisible={isActionBarVisible}\n totalTimeSeconds={totalTimeSeconds}\n feedback={feedback}\n onFeedbackChange={onFeedbackChange}\n onResponseCopy={onResponseCopy}\n />\n )}\n </div>\n );\n }\n);\nAgentResponse.displayName = \"AgentResponse\";\n\nexport { AgentResponse };\n"]}
1
+ {"version":3,"sources":["../src/components/agent-response/components/ActivityIndicators.tsx","../src/components/agent-response/utils.ts","../src/components/agent-response/components/MetadataRow.tsx","../src/components/agent-response/components/ThinkingSection.tsx","../src/components/agent-response/components/ActionBar.tsx","../src/components/hitl-interactions/HITLQuestionPanel.tsx","../src/components/hitl-interactions/HITLInteractionRecord.tsx","../src/components/agent-response/components/HITLSection.tsx","../src/components/agent-response/components/TruncatedMessage.tsx","../src/components/agent-response/hooks/useThinkingTimer.ts","../src/components/agent-response/types.ts","../src/components/agent-response/hooks/useAgentResponseAccumulator.ts","../src/components/agent-response/AgentResponse.tsx","../src/components/user-prompt/UserPrompt.tsx","../src/components/user-prompt-input/UserPromptInput.tsx"],"names":["React","React2","jsxs","jsx","cn","ChevronDown","React3","React4","useState","useCallback","React5","formatTime","React6","useMemo","React7","ChevronRight","React8","useEffect","thinkingStartTime","React9","React10"],"mappings":";;;;;;;;AAmCA,IAAM,kBAAA,GAA2BA,OAAA,CAAA,UAAA;AAAA,EAC/B,CAAC,EAAE,SAAA,EAAW,SAAA,EAAW,MAAA,EAAQ,aAAA,GAAgB,EAAC,EAAG,SAAA,EAAW,GAAG,KAAA,EAAM,EAAG,GAAA,KAAQ;AAClF,IAAA,MAAM,cAAA,GACJ,SAAA,CAAU,MAAA,GAAS,CAAA,IAAK,SAAA,CAAU,MAAA,GAAS,CAAA,IAAK,MAAA,CAAO,MAAA,GAAS,CAAA,IAAK,aAAA,CAAc,MAAA,GAAS,CAAA;AAE9F,IAAA,IAAI,CAAC,gBAAgB,OAAO,IAAA;AAE5B,IAAA,uBACE,IAAA,CAAC,SAAI,GAAA,EAAU,SAAA,EAAW,GAAG,yBAAA,EAA2B,SAAS,CAAA,EAAI,GAAG,KAAA,EAErE,QAAA,EAAA;AAAA,MAAA,aAAA,CAAc,MAAA,GAAS,CAAA,oBACtB,IAAA,CAAC,OAAA,EAAA,EACC,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,cAAA,EAAA,EAAe,SAAO,IAAA,EACrB,QAAA,kBAAA,IAAA;AAAA,UAAC,QAAA;AAAA,UAAA;AAAA,YACC,SAAA,EAAU,uFAAA;AAAA,YACV,OAAA,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AAA,GAAe,cAAA;AAAA,gBAC1C,UAAU,CAAC,SAAA;AAAA,gBACX,OAAA,EAAS;AAAA;AAAA;AACX,WAAA,EAEJ;AAAA;AAAA;AAAA,KACF;AAAA,EAEJ;AACF;AAEA,eAAA,CAAgB,WAAA,GAAc,iBAAA","file":"index.js","sourcesContent":["/**\n * Activity Indicators Component\n *\n * Displays tool, knowledge, memory icons with counts and popovers\n */\n\nimport * as React from \"react\";\nimport { Wrench, Book, HardDrive, Activity } from \"lucide-react\";\nimport { cn, Popover, PopoverTrigger, PopoverContent } from \"@optilogic/core\";\nimport type { ToolCall, KnowledgeItem, MemoryItem, StatusItem } from \"../types\";\n\nexport interface ActivityIndicatorsProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Tool calls to display */\n toolCalls: ToolCall[];\n /** Knowledge items to display */\n knowledge: KnowledgeItem[];\n /** Memory items to display */\n memory: MemoryItem[];\n /** Status updates to display */\n statusUpdates?: StatusItem[];\n}\n\n/**\n * ActivityIndicators Component\n *\n * Displays icons with counts for tool calls, knowledge retrieval, and memory access.\n * Each icon has a popover showing details when clicked.\n *\n * @example\n * <ActivityIndicators\n * toolCalls={state.toolCalls}\n * knowledge={state.knowledge}\n * memory={state.memory}\n * />\n */\nconst ActivityIndicators = React.forwardRef<HTMLDivElement, ActivityIndicatorsProps>(\n ({ toolCalls, knowledge, memory, statusUpdates = [], className, ...props }, ref) => {\n const hasAnyActivity =\n toolCalls.length > 0 || knowledge.length > 0 || memory.length > 0 || statusUpdates.length > 0;\n\n if (!hasAnyActivity) return null;\n\n return (\n <div ref={ref} className={cn(\"flex items-center gap-2\", className)} {...props}>\n {/* Status Updates */}\n {statusUpdates.length > 0 && (\n <Popover>\n <PopoverTrigger asChild>\n <button\n className=\"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors\"\n onClick={(e) => e.stopPropagation()}\n >\n <Activity className=\"w-3.5 h-3.5\" />\n <span className=\"text-xs\">{statusUpdates.length}</span>\n </button>\n </PopoverTrigger>\n <PopoverContent className=\"w-80\">\n <div className=\"space-y-2\">\n <h4 className=\"font-medium text-sm\">Status Updates</h4>\n <div className=\"space-y-2 max-h-60 overflow-auto\">\n {statusUpdates.map((item) => (\n <div key={item.id} className=\"p-2 bg-muted rounded text-xs\">\n {item.agent && (\n <div className=\"font-medium text-muted-foreground\">{item.agent}</div>\n )}\n <div className={item.agent ? \"mt-1\" : \"\"}>{item.message}</div>\n </div>\n ))}\n </div>\n </div>\n </PopoverContent>\n </Popover>\n )}\n\n {/* Tool Calls */}\n {toolCalls.length > 0 && (\n <Popover>\n <PopoverTrigger asChild>\n <button\n className=\"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors\"\n onClick={(e) => e.stopPropagation()}\n >\n <Wrench className=\"w-3.5 h-3.5\" />\n <span className=\"text-xs\">{toolCalls.length}</span>\n </button>\n </PopoverTrigger>\n <PopoverContent className=\"w-80\">\n <div className=\"space-y-2\">\n <h4 className=\"font-medium text-sm\">Tool Calls</h4>\n <div className=\"space-y-2 max-h-60 overflow-auto\">\n {toolCalls.map((tool) => (\n <div key={tool.id} className=\"p-2 bg-muted rounded text-xs\">\n <div className=\"font-medium\">{tool.name}</div>\n {tool.arguments && (\n <pre className=\"mt-1 text-muted-foreground overflow-x-auto\">\n {JSON.stringify(tool.arguments, null, 2)}\n </pre>\n )}\n </div>\n ))}\n </div>\n </div>\n </PopoverContent>\n </Popover>\n )}\n\n {/* Knowledge */}\n {knowledge.length > 0 && (\n <Popover>\n <PopoverTrigger asChild>\n <button\n className=\"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors\"\n onClick={(e) => e.stopPropagation()}\n >\n <Book className=\"w-3.5 h-3.5\" />\n <span className=\"text-xs\">{knowledge.length}</span>\n </button>\n </PopoverTrigger>\n <PopoverContent className=\"w-80\">\n <div className=\"space-y-2\">\n <h4 className=\"font-medium text-sm\">Knowledge Retrieved</h4>\n <div className=\"space-y-2 max-h-60 overflow-auto\">\n {knowledge.map((item) => (\n <div key={item.id} className=\"p-2 bg-muted rounded text-xs\">\n <div className=\"font-medium\">{item.source}</div>\n <div className=\"mt-1 text-muted-foreground\">\n {item.content}\n </div>\n </div>\n ))}\n </div>\n </div>\n </PopoverContent>\n </Popover>\n )}\n\n {/* Memory */}\n {memory.length > 0 && (\n <Popover>\n <PopoverTrigger asChild>\n <button\n className=\"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors\"\n onClick={(e) => e.stopPropagation()}\n >\n <HardDrive className=\"w-3.5 h-3.5\" />\n <span className=\"text-xs\">{memory.length}</span>\n </button>\n </PopoverTrigger>\n <PopoverContent className=\"w-80\">\n <div className=\"space-y-2\">\n <h4 className=\"font-medium text-sm\">Memory Accessed</h4>\n <div className=\"space-y-2 max-h-60 overflow-auto\">\n {memory.map((item) => (\n <div key={item.id} className=\"p-2 bg-muted rounded text-xs\">\n <div className=\"font-medium\">{item.type}</div>\n <div className=\"mt-1 text-muted-foreground\">\n {item.content}\n </div>\n </div>\n ))}\n </div>\n </div>\n </PopoverContent>\n </Popover>\n )}\n </div>\n );\n }\n);\nActivityIndicators.displayName = \"ActivityIndicators\";\n\nexport { ActivityIndicators };\n","/**\n * Agent Response Utility Functions\n */\n\n/**\n * Format elapsed time for display\n * - Under 60s: \"Xs\" (e.g., \"23s\")\n * - 60+ seconds while active: \"M:SS\" (e.g., \"1:23\")\n * - Complete under 60s: \"Xs\" (e.g., \"45s\")\n * - Complete 60-119s: \"1.X min\" (e.g., \"1.2 min\")\n * - Complete 120+ s: \"X.X min\" (e.g., \"2.5 min\")\n */\nexport function formatTime(seconds: number, isComplete: boolean): string {\n if (seconds < 1) {\n return isComplete ? \"<1s\" : \"0s\";\n }\n\n if (isComplete) {\n // Completed state formatting\n if (seconds < 60) {\n return `${Math.round(seconds)}s`;\n }\n const minutes = seconds / 60;\n return `${minutes.toFixed(1)} min`;\n }\n\n // Active state formatting\n if (seconds < 60) {\n return `${Math.floor(seconds)}s`;\n }\n const mins = Math.floor(seconds / 60);\n const secs = Math.floor(seconds % 60);\n return `${mins}:${secs.toString().padStart(2, \"0\")}`;\n}\n\n/**\n * Format total time for action bar display\n */\nexport function formatTotalTime(seconds: number): string {\n if (seconds < 1) {\n return \"<1s\";\n }\n if (seconds < 60) {\n return `${seconds.toFixed(1)}s`;\n }\n const minutes = seconds / 60;\n return `${minutes.toFixed(1)}m`;\n}\n","/**\n * Metadata Row Component\n *\n * Displays thinking toggle, timer, and activity indicators\n */\n\nimport * as React from \"react\";\nimport { ChevronDown, ChevronUp } from \"lucide-react\";\nimport { cn, LoadingSpinner } from \"@optilogic/core\";\nimport { ActivityIndicators } from \"./ActivityIndicators\";\nimport { formatTime } from \"../utils\";\nimport type { AgentResponseStatus, ToolCall, KnowledgeItem, MemoryItem, StatusItem } from \"../types\";\n\nexport interface MetadataRowProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Whether there is thinking content */\n hasThinking: boolean;\n /** Whether the thinking section is expanded */\n isExpanded: boolean;\n /** Toggle callback for thinking expansion */\n onToggle: () => void;\n /** Tool calls to display */\n toolCalls: ToolCall[];\n /** Knowledge items to display */\n knowledge: KnowledgeItem[];\n /** Memory items to display */\n memory: MemoryItem[];\n /** Status updates to display */\n statusUpdates?: StatusItem[];\n /** Optional content to display in the middle area between left content and activity indicators */\n statusContent?: React.ReactNode;\n /** Current response status */\n status: AgentResponseStatus;\n /** Elapsed time in seconds */\n elapsedTime: number;\n}\n\n/**\n * MetadataRow Component\n *\n * Displays the metadata row with thinking toggle, timer, and activity indicators.\n * When thinking content is present, the row is clickable to toggle expansion.\n *\n * @example\n * <MetadataRow\n * hasThinking={!!state.thinking}\n * isExpanded={thinkingExpanded}\n * onToggle={toggleThinking}\n * toolCalls={state.toolCalls}\n * knowledge={state.knowledge}\n * memory={state.memory}\n * status={state.status}\n * elapsedTime={elapsedTime}\n * />\n */\nconst MetadataRow = React.forwardRef<HTMLDivElement, MetadataRowProps>(\n (\n {\n hasThinking,\n isExpanded,\n onToggle,\n toolCalls,\n knowledge,\n memory,\n statusUpdates = [],\n statusContent,\n status,\n elapsedTime,\n className,\n ...props\n },\n ref\n ) => {\n const isProcessing = status === \"processing\";\n const isComplete = status === \"complete\";\n const hasActivity =\n toolCalls.length > 0 || knowledge.length > 0 || memory.length > 0 || statusUpdates.length > 0;\n\n // Determine what to show on the left side\n const renderLeftContent = () => {\n // If we have thinking text, show collapse toggle + label + timer\n if (hasThinking) {\n return (\n <div className=\"flex items-center gap-1.5\">\n {isExpanded ? (\n <ChevronUp className=\"w-3.5 h-3.5 text-muted-foreground\" />\n ) : (\n <ChevronDown className=\"w-3.5 h-3.5 text-muted-foreground\" />\n )}\n <span className=\"text-xs text-muted-foreground\">\n {isComplete\n ? `Thought for ${formatTime(elapsedTime, true)}`\n : `Thinking... ${formatTime(elapsedTime, false)}`}\n </span>\n </div>\n );\n }\n\n // If processing but no thinking text yet, show spinner\n if (isProcessing) {\n return (\n <div className=\"flex items-center gap-1.5\">\n <LoadingSpinner size=\"sm\" variant=\"muted\" className=\"w-3.5 h-3.5\" />\n <span className=\"text-xs text-muted-foreground\">Processing</span>\n </div>\n );\n }\n\n // Complete with no thinking - show nothing on left (just activity on right)\n return null;\n };\n\n const leftContent = renderLeftContent();\n\n // If nothing to show (no thinking, not processing, no activity, no status content), hide the row\n if (!leftContent && !hasActivity && !statusContent) {\n return null;\n }\n\n // Always use a div for the row to avoid nesting buttons\n // When there's thinking, only the left side is clickable\n return (\n <div\n ref={ref}\n className={cn(\"w-full flex items-center justify-between px-3 py-2\", className)}\n {...props}\n >\n {/* Left content - clickable when there's thinking */}\n {hasThinking ? (\n <button\n onClick={onToggle}\n className=\"flex items-center gap-1.5 hover:bg-muted/50 -ml-1.5 pl-1.5 pr-2 py-0.5 rounded transition-colors shrink-0\"\n >\n {leftContent}\n </button>\n ) : (\n <div className=\"flex items-center gap-1.5 shrink-0\">\n {leftContent}\n </div>\n )}\n\n {/* Middle content - status content slot */}\n {statusContent && (\n <div className=\"flex-1 min-w-0 mx-2\">\n {statusContent}\n </div>\n )}\n\n <ActivityIndicators\n toolCalls={toolCalls}\n knowledge={knowledge}\n memory={memory}\n statusUpdates={statusUpdates}\n />\n </div>\n );\n }\n);\nMetadataRow.displayName = \"MetadataRow\";\n\nexport { MetadataRow };\n","/**\n * Thinking Section Component\n *\n * Collapsible section for displaying agent thinking/reasoning content.\n * Supports both plain text and structured collapsible sub-sections.\n */\n\nimport * as React from \"react\";\nimport { useState, useCallback } from \"react\";\nimport { ChevronDown, ChevronRight } from \"lucide-react\";\nimport { cn } from \"@optilogic/core\";\nimport type { ThinkingStep } from \"../types\";\n\nexport interface ThinkingSectionProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"content\"> {\n /** The thinking content to display (string or structured steps) */\n content: string | ThinkingStep[];\n /** Whether the section is expanded */\n isExpanded: boolean;\n /**\n * Custom markdown renderer for the thinking content.\n * If not provided, the content will be rendered as plain preformatted text.\n */\n renderMarkdown?: (content: string) => React.ReactNode;\n}\n\n/**\n * Internal component for rendering a collapsible thinking step\n */\ninterface ThinkingStepItemProps {\n step: ThinkingStep;\n renderMarkdown?: (content: string) => React.ReactNode;\n}\n\nconst ThinkingStepItem: React.FC<ThinkingStepItemProps> = ({ step, renderMarkdown }) => {\n const [isCollapsed, setIsCollapsed] = useState(step.isCollapsed ?? false);\n\n const toggleCollapse = useCallback(() => {\n setIsCollapsed((prev) => !prev);\n }, []);\n\n const indentPadding = step.depth * 16;\n\n return (\n <div className=\"border-b border-border/50 last:border-b-0\">\n <button\n onClick={toggleCollapse}\n className=\"w-full flex items-center gap-1.5 py-1.5 px-2 hover:bg-muted/50 transition-colors text-left\"\n style={{ paddingLeft: `${indentPadding + 8}px` }}\n >\n {isCollapsed ? (\n <ChevronRight className=\"w-3 h-3 text-muted-foreground flex-shrink-0\" />\n ) : (\n <ChevronDown className=\"w-3 h-3 text-muted-foreground flex-shrink-0\" />\n )}\n <span className=\"text-xs font-medium text-foreground/80\">{step.label}</span>\n </button>\n\n {!isCollapsed && (\n <div\n className=\"pb-2 px-2\"\n style={{ paddingLeft: `${indentPadding + 28}px` }}\n >\n {renderMarkdown ? (\n <div className=\"text-xs text-muted-foreground\">\n {renderMarkdown(step.content)}\n </div>\n ) : (\n <pre className=\"text-xs text-muted-foreground whitespace-pre-wrap font-mono\">\n {step.content}\n </pre>\n )}\n </div>\n )}\n </div>\n );\n};\n\n/**\n * ThinkingSection Component\n *\n * Displays the agent's thinking/reasoning content in a collapsible panel.\n * Supports both plain text content and structured collapsible sub-sections.\n *\n * @example\n * // Plain text content\n * <ThinkingSection content={state.thinking} isExpanded={isExpanded} />\n *\n * @example\n * // Structured content with sub-sections\n * <ThinkingSection\n * content={[\n * { id: \"1\", label: \"Analysis\", content: \"...\", depth: 0 },\n * { id: \"2\", label: \"Sub-analysis\", content: \"...\", depth: 1 },\n * ]}\n * isExpanded={isExpanded}\n * />\n */\nconst ThinkingSection = React.forwardRef<HTMLDivElement, ThinkingSectionProps>(\n ({ content, isExpanded, renderMarkdown, className, ...props }, ref) => {\n if (!isExpanded || !content || (Array.isArray(content) && content.length === 0)) {\n return null;\n }\n\n const isStructured = Array.isArray(content);\n\n return (\n <div\n ref={ref}\n className={cn(\"px-3 pb-3 border-t border-border\", className)}\n {...props}\n >\n <div className=\"mt-2 max-h-[200px] overflow-y-auto\">\n {isStructured ? (\n <div className=\"space-y-0\">\n {content.map((step) => (\n <ThinkingStepItem\n key={step.id}\n step={step}\n renderMarkdown={renderMarkdown}\n />\n ))}\n </div>\n ) : renderMarkdown ? (\n <div className=\"text-xs text-muted-foreground\">\n {renderMarkdown(content)}\n </div>\n ) : (\n <pre className=\"text-xs text-muted-foreground whitespace-pre-wrap font-mono\">\n {content}\n </pre>\n )}\n </div>\n </div>\n );\n }\n);\nThinkingSection.displayName = \"ThinkingSection\";\n\nexport { ThinkingSection };\n","/**\n * Action Bar Component\n *\n * Displays copy, feedback, and timing actions for the response\n */\n\nimport * as React from \"react\";\nimport { useState, useCallback } from \"react\";\nimport { Copy, Check, ThumbsUp, ThumbsDown } from \"lucide-react\";\nimport { cn } from \"@optilogic/core\";\nimport { formatTotalTime } from \"../utils\";\nimport type { FeedbackValue } from \"../types\";\n\nexport interface ActionBarProps extends React.HTMLAttributes<HTMLDivElement> {\n /** The response text (for copying) */\n response: string;\n /** Whether the action bar is visible */\n isVisible: boolean;\n /** Total time in seconds */\n totalTimeSeconds: number;\n /** Current feedback value */\n feedback?: FeedbackValue;\n /** Callback when feedback changes */\n onFeedbackChange?: (feedback: FeedbackValue) => void;\n /** Callback when response is copied */\n onResponseCopy?: (response: string) => void;\n}\n\n/**\n * ActionBar Component\n *\n * Displays action buttons for copying the response, providing feedback,\n * and showing total response time.\n *\n * @example\n * <ActionBar\n * response={state.response}\n * isVisible={isHovered}\n * totalTimeSeconds={totalTime}\n * feedback={feedback}\n * onFeedbackChange={setFeedback}\n * onCopy={handleCopy}\n * />\n */\nconst ActionBar = React.forwardRef<HTMLDivElement, ActionBarProps>(\n (\n {\n response,\n isVisible,\n totalTimeSeconds,\n feedback,\n onFeedbackChange,\n onResponseCopy,\n className,\n ...props\n },\n ref\n ) => {\n const [copied, setCopied] = useState(false);\n\n const handleCopy = useCallback(async () => {\n try {\n await navigator.clipboard.writeText(response);\n setCopied(true);\n setTimeout(() => setCopied(false), 2000);\n onResponseCopy?.(response);\n } catch (err) {\n console.error(\"Failed to copy response:\", err);\n }\n }, [response, onResponseCopy]);\n\n const handleThumbsUp = useCallback(() => {\n const newValue = feedback === \"up\" ? null : \"up\";\n onFeedbackChange?.(newValue);\n }, [feedback, onFeedbackChange]);\n\n const handleThumbsDown = useCallback(() => {\n const newValue = feedback === \"down\" ? null : \"down\";\n onFeedbackChange?.(newValue);\n }, [feedback, onFeedbackChange]);\n\n const isThumbsUp = feedback === \"up\";\n const isThumbsDown = feedback === \"down\";\n\n return (\n <div\n ref={ref}\n className={cn(\n \"flex items-center justify-between px-4 py-2\",\n \"transition-opacity duration-200\",\n isVisible ? \"opacity-100\" : \"opacity-0 pointer-events-none\",\n className\n )}\n {...props}\n >\n {/* Left side - action buttons */}\n <div className=\"flex items-center gap-1\">\n {/* Copy button */}\n <button\n onClick={handleCopy}\n className=\"p-1.5 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground\"\n title={copied ? \"Copied!\" : \"Copy response\"}\n >\n {copied ? (\n <Check className=\"w-4 h-4 text-green-500\" />\n ) : (\n <Copy className=\"w-4 h-4\" />\n )}\n </button>\n\n {/* Thumbs up */}\n <button\n onClick={handleThumbsUp}\n className={cn(\n \"p-1.5 rounded hover:bg-muted transition-colors\",\n isThumbsUp\n ? \"text-green-500\"\n : \"text-muted-foreground hover:text-foreground\"\n )}\n title=\"Good response\"\n >\n <ThumbsUp className={cn(\"w-4 h-4\", isThumbsUp && \"fill-current\")} />\n </button>\n\n {/* Thumbs down */}\n <button\n onClick={handleThumbsDown}\n className={cn(\n \"p-1.5 rounded hover:bg-muted transition-colors\",\n isThumbsDown\n ? \"text-red-500\"\n : \"text-muted-foreground hover:text-foreground\"\n )}\n title=\"Poor response\"\n >\n <ThumbsDown className={cn(\"w-4 h-4\", isThumbsDown && \"fill-current\")} />\n </button>\n </div>\n\n {/* Right side - timing info */}\n <span className=\"text-xs text-muted-foreground\">\n Total time: {formatTotalTime(totalTimeSeconds)}\n </span>\n </div>\n );\n }\n);\nActionBar.displayName = \"ActionBar\";\n\nexport { ActionBar };\n","/**\n * HITLQuestionPanel — Human-in-the-Loop clarifying question panel.\n *\n * Renders in the input area (replacing UserPromptInput) when the agent asks a\n * clarifying question via the HumanInTheLoop tool. Shows the question details\n * and lets the user respond via option buttons or free-form text.\n *\n * Option clicks select/toggle rather than immediately submitting. The \"Send\n * response\" button enables once all questions have a selected option OR the\n * textarea has text. On submit, selected options and free-form text are\n * combined into a single formatted string for the backend.\n */\n\nimport * as React from \"react\";\nimport { useState, useEffect, useRef, useCallback, useMemo } from \"react\";\nimport { cn, Button, Textarea } from \"@optilogic/core\";\n\nexport interface HITLQuestion {\n reason: string;\n questions: string[];\n options: Record<string, string[]> | null;\n context: string | null;\n /** Timeout in seconds. When omitted, no countdown is shown and the panel never times out. */\n timeoutSeconds?: number;\n receivedAt: number;\n}\n\nexport interface HITLQuestionPanelProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onSubmit\"> {\n question: HITLQuestion;\n onSubmit: (response: string) => void;\n onStop: () => void;\n}\n\n/**\n * Build a single response string from selected options and optional free-form text.\n * Format is designed to be easily parsed by the LLM consuming the response.\n */\nexport function buildResponseString(\n questions: string[],\n selectedOptions: Record<string, string>,\n freeformText: string\n): string {\n const parts: string[] = [];\n\n for (const q of questions) {\n const answer = selectedOptions[q];\n if (answer) {\n parts.push(`Q: ${q}\\nA: ${answer}`);\n }\n }\n\n const trimmed = freeformText.trim();\n if (trimmed) {\n parts.push(`Additional context: ${trimmed}`);\n }\n\n return parts.join(\"\\n\\n\");\n}\n\nconst HITLQuestionPanel = React.forwardRef<\n HTMLDivElement,\n HITLQuestionPanelProps\n>(({ question, onSubmit, onStop, className, ...props }, ref) => {\n const [freeformText, setFreeformText] = useState(\"\");\n const [selectedOptions, setSelectedOptions] = useState<\n Record<string, string>\n >({});\n const hasTimeout = question.timeoutSeconds != null;\n const [secondsLeft, setSecondsLeft] = useState(() =>\n hasTimeout\n ? Math.max(\n 0,\n Math.round(\n question.timeoutSeconds! - (Date.now() - question.receivedAt) / 1000\n )\n )\n : Infinity\n );\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n\n // Focus the textarea on mount\n useEffect(() => {\n textareaRef.current?.focus();\n }, []);\n\n // Countdown timer (only when timeoutSeconds is provided)\n useEffect(() => {\n if (!hasTimeout) return;\n const interval = setInterval(() => {\n const remaining = Math.max(\n 0,\n Math.round(\n question.timeoutSeconds! - (Date.now() - question.receivedAt) / 1000\n )\n );\n setSecondsLeft(remaining);\n if (remaining <= 0) clearInterval(interval);\n }, 1000);\n return () => clearInterval(interval);\n }, [hasTimeout, question.timeoutSeconds, question.receivedAt]);\n\n const timedOut = hasTimeout && secondsLeft <= 0;\n\n // Which questions have options defined?\n const questionsWithOptions = useMemo(\n () => question.questions.filter((q) => question.options?.[q]?.length),\n [question.questions, question.options]\n );\n\n const allOptionsSelected =\n questionsWithOptions.length > 0 &&\n questionsWithOptions.every((q) => selectedOptions[q]);\n\n const hasFreeformText = freeformText.trim().length > 0;\n\n const canSubmit = !timedOut && (allOptionsSelected || hasFreeformText);\n\n const handleOptionClick = useCallback(\n (questionText: string, option: string) => {\n if (timedOut) return;\n setSelectedOptions((prev) => {\n // Toggle: deselect if already selected, otherwise select\n if (prev[questionText] === option) {\n const next = { ...prev };\n delete next[questionText];\n return next;\n }\n return { ...prev, [questionText]: option };\n });\n },\n [timedOut]\n );\n\n const handleSubmit = useCallback(() => {\n if (!canSubmit) return;\n const combined = buildResponseString(\n question.questions,\n selectedOptions,\n freeformText\n );\n onSubmit(combined);\n }, [canSubmit, question.questions, selectedOptions, freeformText, onSubmit]);\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 formatTime = (s: number) => {\n const m = Math.floor(s / 60);\n const sec = s % 60;\n return `${m}:${sec.toString().padStart(2, \"0\")}`;\n };\n\n return (\n <div\n ref={ref}\n className={cn(\n \"rounded-lg border border-border bg-muted p-4 space-y-3\",\n className\n )}\n {...props}\n >\n {/* Header: reason + countdown */}\n <div className=\"flex items-start justify-between gap-3\">\n <div className=\"flex-1\">\n <p className=\"text-sm font-medium text-foreground\">\n {question.reason}\n </p>\n </div>\n {hasTimeout && (\n <span\n className={cn(\n \"text-xs font-mono whitespace-nowrap\",\n secondsLeft <= 30 ? \"text-destructive\" : \"text-muted-foreground\"\n )}\n >\n {timedOut ? \"Timed out\" : formatTime(secondsLeft)}\n </span>\n )}\n </div>\n\n {/* Context (if provided) */}\n {question.context && (\n <div className=\"text-xs text-muted-foreground bg-background rounded p-2 border border-border max-h-24 overflow-y-auto\">\n <pre className=\"whitespace-pre-wrap font-mono\">\n {question.context}\n </pre>\n </div>\n )}\n\n {/* Questions */}\n <div className=\"space-y-3\">\n {question.questions.map((q, i) => (\n <div key={i}>\n <p className=\"text-sm text-foreground\">{q}</p>\n\n {/* Options for this question (if provided) */}\n {question.options?.[q] && (\n <div className=\"flex flex-wrap gap-2 mt-1.5\">\n {question.options[q].map((option, j) => {\n const isSelected = selectedOptions[q] === option;\n return (\n <Button\n key={j}\n variant={isSelected ? \"primary\" : \"outline\"}\n size=\"sm\"\n onClick={() => handleOptionClick(q, option)}\n disabled={timedOut}\n >\n {option}\n </Button>\n );\n })}\n </div>\n )}\n </div>\n ))}\n </div>\n\n {/* Free-form input — always shown for additional context */}\n <Textarea\n ref={textareaRef}\n value={freeformText}\n onChange={(e) => setFreeformText(e.target.value)}\n onKeyDown={handleKeyDown}\n disabled={timedOut}\n placeholder=\"Add additional context or type a full response...\"\n rows={2}\n className=\"resize-none\"\n />\n\n <div className=\"flex items-center justify-between\">\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={onStop}\n className=\"text-destructive hover:text-destructive hover:bg-destructive/10\"\n >\n Stop agent\n </Button>\n\n <Button\n variant=\"primary\"\n size=\"sm\"\n onClick={handleSubmit}\n disabled={!canSubmit}\n >\n Send response\n </Button>\n </div>\n </div>\n );\n});\nHITLQuestionPanel.displayName = \"HITLQuestionPanel\";\n\nexport { HITLQuestionPanel };\n","/**\n * HITLInteractionRecord — Displays a completed HITL Q&A interaction\n * in the chat message history.\n *\n * Rendered below AgentResponse in the agent message block. Shows the full detail\n * of each clarifying question the agent asked and the user's response.\n */\n\nimport * as React from \"react\";\nimport { useMemo } from \"react\";\nimport { cn } from \"@optilogic/core\";\nimport type { HITLQuestion } from \"./HITLQuestionPanel\";\n\nexport interface HITLInteraction {\n question: HITLQuestion;\n response: string;\n respondedAt: number;\n}\n\nexport interface HITLInteractionRecordProps\n extends React.HTMLAttributes<HTMLDivElement> {\n interaction: HITLInteraction;\n}\n\n/**\n * Parse the formatted response string (produced by buildResponseString) back\n * into a per-question answer map and optional additional context.\n */\nfunction parseResponse(response: string): {\n answers: Record<string, string>;\n additionalContext: string | null;\n} {\n const answers: Record<string, string> = {};\n let additionalContext: string | null = null;\n\n const blocks = response.split(\"\\n\\n\");\n for (const block of blocks) {\n const qaMatch = block.match(/^Q: (.+)\\nA: (.+)$/s);\n if (qaMatch) {\n answers[qaMatch[1].trim()] = qaMatch[2].trim();\n } else if (block.startsWith(\"Additional context: \")) {\n additionalContext = block.slice(\"Additional context: \".length).trim();\n }\n }\n\n return { answers, additionalContext };\n}\n\nconst HITLInteractionRecord = React.forwardRef<\n HTMLDivElement,\n HITLInteractionRecordProps\n>(({ interaction, className, ...props }, ref) => {\n const { question, response, respondedAt } = interaction;\n const timestamp = new Date(respondedAt).toLocaleTimeString([], {\n hour: \"2-digit\",\n minute: \"2-digit\",\n });\n\n const { answers, additionalContext } = useMemo(\n () => parseResponse(response),\n [response]\n );\n\n // Check if parsing found any structured answers; if not, fall back to\n // showing the raw response string (for responses not built by buildResponseString).\n const hasParsedAnswers = Object.keys(answers).length > 0;\n\n return (\n <div\n ref={ref}\n className={cn(\n \"rounded-lg border border-border bg-muted p-3 space-y-2 text-sm\",\n className\n )}\n {...props}\n >\n {/* Header */}\n <div className=\"flex items-center justify-between\">\n <span className=\"font-medium text-muted-foreground\">\n Clarifying Question\n </span>\n <span className=\"text-xs text-muted-foreground\">{timestamp}</span>\n </div>\n\n {/* Reason */}\n <p className=\"text-foreground font-medium\">{question.reason}</p>\n\n {/* Context (if provided) */}\n {question.context && (\n <div className=\"text-xs text-muted-foreground bg-background rounded p-2 border border-border\">\n <pre className=\"whitespace-pre-wrap font-mono\">\n {question.context}\n </pre>\n </div>\n )}\n\n {/* Questions with inline answers */}\n <div className=\"space-y-2\">\n {question.questions.map((q, i) => (\n <div key={i}>\n <p className=\"text-foreground\">{q}</p>\n {question.options?.[q] && (\n <p className=\"text-xs text-muted-foreground ml-2\">\n Options: {question.options[q].join(\", \")}\n </p>\n )}\n {hasParsedAnswers && answers[q] && (\n <p className=\"text-xs text-foreground ml-2 mt-0.5 bg-background rounded px-2 py-1 border border-border\">\n <span className=\"text-muted-foreground\">Answer: </span>\n {answers[q]}\n </p>\n )}\n </div>\n ))}\n </div>\n\n {/* Additional context from freeform text, or raw fallback */}\n {hasParsedAnswers && additionalContext && (\n <div className=\"border-t border-border pt-2\">\n <span className=\"text-muted-foreground text-xs\">\n Additional context:\n </span>\n <p className=\"text-foreground mt-0.5\">{additionalContext}</p>\n </div>\n )}\n\n {/* Fallback: show raw response if it wasn't in the parsed Q/A format */}\n {!hasParsedAnswers && (\n <div className=\"border-t border-border pt-2\">\n <span className=\"text-muted-foreground text-xs\">Response:</span>\n <p className=\"text-foreground mt-0.5\">{response}</p>\n </div>\n )}\n </div>\n );\n});\nHITLInteractionRecord.displayName = \"HITLInteractionRecord\";\n\nexport { HITLInteractionRecord };\n","/**\n * HITL Section Component\n *\n * Collapsible section for displaying completed HITL (Human-in-the-Loop)\n * interactions within an AgentResponse. Follows the same pattern as\n * ThinkingSection for consistent UX.\n */\n\nimport * as React from \"react\";\nimport { useState, useCallback } from \"react\";\nimport { ChevronDown, ChevronRight, MessageCircleQuestion } from \"lucide-react\";\nimport { cn } from \"@optilogic/core\";\nimport { HITLInteractionRecord } from \"../../hitl-interactions\";\nimport type { HITLInteraction } from \"../../hitl-interactions\";\n\nexport interface HITLSectionProps\n extends React.HTMLAttributes<HTMLDivElement> {\n /** The HITL interactions to display */\n interactions: HITLInteraction[];\n /** Whether the section starts expanded (uncontrolled) */\n defaultExpanded?: boolean;\n /** Whether the section is expanded (controlled) */\n isExpanded?: boolean;\n /** Callback when expansion state changes (controlled) */\n onExpandedChange?: (expanded: boolean) => void;\n}\n\nconst HITLSection = React.forwardRef<HTMLDivElement, HITLSectionProps>(\n (\n {\n interactions,\n defaultExpanded = false,\n isExpanded: controlledExpanded,\n onExpandedChange,\n className,\n ...props\n },\n ref\n ) => {\n const [uncontrolledExpanded, setUncontrolledExpanded] =\n useState(defaultExpanded);\n\n const isControlled = controlledExpanded !== undefined;\n const isExpanded = isControlled ? controlledExpanded : uncontrolledExpanded;\n\n const toggleExpanded = useCallback(() => {\n const newValue = !isExpanded;\n if (isControlled) {\n onExpandedChange?.(newValue);\n } else {\n setUncontrolledExpanded(newValue);\n }\n }, [isExpanded, isControlled, onExpandedChange]);\n\n if (!interactions || interactions.length === 0) {\n return null;\n }\n\n return (\n <div\n ref={ref}\n className={cn(\"border-t border-border\", className)}\n {...props}\n >\n {/* Collapsible header */}\n <button\n onClick={toggleExpanded}\n className=\"w-full flex items-center gap-2 py-2 px-3 hover:bg-muted/50 transition-colors text-left\"\n >\n {isExpanded ? (\n <ChevronDown className=\"w-3.5 h-3.5 text-muted-foreground flex-shrink-0\" />\n ) : (\n <ChevronRight className=\"w-3.5 h-3.5 text-muted-foreground flex-shrink-0\" />\n )}\n <MessageCircleQuestion className=\"w-3.5 h-3.5 text-muted-foreground flex-shrink-0\" />\n <span className=\"text-xs font-medium text-foreground/80\">\n Clarifying Questions ({interactions.length})\n </span>\n </button>\n\n {/* Expanded content */}\n {isExpanded && (\n <div className=\"px-3 pb-3 space-y-2\">\n {interactions.map((interaction, i) => (\n <HITLInteractionRecord key={i} interaction={interaction} />\n ))}\n </div>\n )}\n </div>\n );\n }\n);\nHITLSection.displayName = \"HITLSection\";\n\nexport { HITLSection };\n","/**\n * Truncated Message Component\n *\n * Renders a single-line text message with CSS-based truncation (text-overflow: ellipsis).\n * Designed as a standalone utility that can be used anywhere, including as\n * the statusContent slot in MetadataRow.\n */\n\nimport * as React from \"react\";\nimport { cn } from \"@optilogic/core\";\n\nexport interface TruncatedMessageProps extends React.HTMLAttributes<HTMLDivElement> {\n /** The message string to display (truncated with ellipsis if it overflows) */\n message: string;\n}\n\n/**\n * TruncatedMessage Component\n *\n * Displays a single-line text message that truncates with an ellipsis when\n * it overflows its container. Uses CSS text-overflow for zero-JS truncation.\n *\n * @example\n * <TruncatedMessage message=\"Searching the knowledge base for relevant documents...\" />\n *\n * @example\n * // Inside MetadataRow's statusContent slot\n * <AgentResponse\n * state={state}\n * statusContent={<TruncatedMessage message=\"Running analysis...\" />}\n * />\n */\nconst TruncatedMessage = React.forwardRef<HTMLDivElement, TruncatedMessageProps>(\n ({ message, className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\n \"text-xs text-muted-foreground truncate min-w-0\",\n className\n )}\n title={message}\n {...props}\n >\n {message}\n </div>\n );\n }\n);\nTruncatedMessage.displayName = \"TruncatedMessage\";\n\nexport { TruncatedMessage };\n","/**\n * useThinkingTimer Hook\n *\n * Tracks elapsed time during agent thinking/processing\n */\n\nimport { useState, useEffect } from \"react\";\nimport type { AgentResponseStatus } from \"../types\";\n\nexport interface UseThinkingTimerOptions {\n startTime: number | null;\n endTime: number | null;\n status: AgentResponseStatus;\n}\n\n/**\n * Custom hook for thinking timer\n * Returns elapsed time in seconds\n */\nexport function useThinkingTimer({\n startTime,\n endTime,\n status,\n}: UseThinkingTimerOptions): number {\n const [elapsed, setElapsed] = useState(0);\n\n useEffect(() => {\n if (!startTime) {\n setElapsed(0);\n return;\n }\n\n // If complete, calculate final elapsed time\n if (status === \"complete\" && endTime) {\n setElapsed((endTime - startTime) / 1000);\n return;\n }\n\n // If still processing, update every second\n if (status === \"processing\") {\n const updateElapsed = () => {\n setElapsed((Date.now() - startTime) / 1000);\n };\n\n updateElapsed(); // Initial update\n const interval = setInterval(updateElapsed, 1000);\n return () => clearInterval(interval);\n }\n }, [startTime, endTime, status]);\n\n return elapsed;\n}\n","/**\n * Agent Response Component Types\n *\n * Type definitions for the library-ready agent response component\n */\n\n/**\n * Status of the agent response cycle\n */\nexport type AgentResponseStatus = \"idle\" | \"processing\" | \"complete\";\n\n/**\n * Feedback value for the response\n */\nexport type FeedbackValue = \"up\" | \"down\" | null;\n\n/**\n * Tool call information from the agent\n */\nexport interface ToolCall {\n id: string;\n name: string;\n arguments?: Record<string, unknown>;\n timestamp: number;\n}\n\n/**\n * Knowledge retrieval information\n */\nexport interface KnowledgeItem {\n id: string;\n source: string;\n content: string;\n timestamp: number;\n}\n\n/**\n * Memory access information\n */\nexport interface MemoryItem {\n id: string;\n type: string;\n content: string;\n timestamp: number;\n}\n\n/**\n * Status update information from the agent\n */\nexport interface StatusItem {\n id: string;\n message: string;\n timestamp: number;\n /** Optional agent name if in multi-agent scenario */\n agent?: string;\n}\n\n/**\n * A single step in structured thinking content\n */\nexport interface ThinkingStep {\n /** Unique identifier for the step */\n id: string;\n /** Label/title shown in the collapsible header */\n label: string;\n /** Content of the thinking step */\n content: string;\n /** Nesting depth (0 = root level, 1 = first indent, etc.) */\n depth: number;\n /** Whether this step should start collapsed (default: false) */\n isCollapsed?: boolean;\n}\n\n/**\n * Union type for thinking content\n * - string: plain text (backward compatible)\n * - ThinkingStep[]: structured with collapsible sub-sections\n */\nexport type ThinkingContent = string | ThinkingStep[];\n\n/**\n * State shape for the agent response component\n */\nexport interface AgentResponseState {\n /** Current status of the response cycle */\n status: AgentResponseStatus;\n /** Accumulated thinking/reasoning text */\n thinking: string;\n /** Structured thinking steps (if provided, takes precedence over thinking string) */\n thinkingSteps?: ThinkingStep[];\n /** Tool calls made during processing */\n toolCalls: ToolCall[];\n /** Knowledge items retrieved */\n knowledge: KnowledgeItem[];\n /** Memory items accessed */\n memory: MemoryItem[];\n /** Status updates from the agent */\n statusUpdates: StatusItem[];\n /** Final response text */\n response: string;\n /** Timestamp when first thinking message was received (for timer) */\n thinkingStartTime: number | null;\n /** Timestamp when response was completed (for final timer display) */\n responseCompleteTime: number | null;\n /** Timestamp when first message of any type was received (for total time) */\n firstMessageTime: number | null;\n}\n\n/**\n * WebSocket message payload for agent responses\n */\nexport interface AgentMessage {\n type: \"status\" | \"thinking\" | \"tool_call\" | \"knowledge\" | \"memory\" | \"response\" | \"status_update\";\n /** Message content - for simple string payloads */\n message?: string;\n /** Alternative content field */\n content?: string;\n /** For status messages */\n status?: string;\n /** For tool_call messages */\n tool?: {\n id: string;\n name: string;\n arguments?: Record<string, unknown>;\n };\n /** For knowledge messages */\n knowledge?: {\n id: string;\n source: string;\n content: string;\n };\n /** For memory messages */\n memory?: {\n id: string;\n type: string;\n content: string;\n };\n /** For status_update messages */\n statusUpdate?: {\n id: string;\n message: string;\n agent?: string;\n };\n /** For structured thinking step messages */\n thinkingStep?: {\n id?: string;\n label: string;\n content: string;\n depth?: number;\n isCollapsed?: boolean;\n };\n}\n\n/**\n * Generic websocket message wrapper type\n */\nexport interface GenericWebSocketMessage {\n topic: string;\n message: AgentMessage;\n accountId?: string;\n}\n\n/**\n * Initial state for the agent response component\n */\nexport const initialAgentResponseState: AgentResponseState = {\n status: \"idle\",\n thinking: \"\",\n toolCalls: [],\n knowledge: [],\n memory: [],\n statusUpdates: [],\n response: \"\",\n thinkingStartTime: null,\n responseCompleteTime: null,\n firstMessageTime: null,\n};\n","/**\n * useAgentResponseAccumulator Hook\n *\n * Accumulates agent response messages into a unified state\n */\n\nimport { useState, useCallback } from \"react\";\nimport {\n initialAgentResponseState,\n type AgentResponseState,\n type AgentMessage,\n type GenericWebSocketMessage,\n type ToolCall,\n type KnowledgeItem,\n type MemoryItem,\n type StatusItem,\n type ThinkingStep,\n} from \"../types\";\n\nexport interface UseAgentResponseAccumulatorOptions {\n /** WebSocket topic to filter messages (optional, for convenience) */\n topic?: string;\n}\n\nexport interface UseAgentResponseAccumulatorReturn {\n /** Current accumulated state */\n state: AgentResponseState;\n\n /** Handler to process incoming messages */\n handleMessage: (message: unknown) => void;\n\n /** Reset state to initial */\n reset: () => void;\n}\n\n/**\n * Hook for accumulating agent response messages into a unified state\n *\n * @example\n * const { state, handleMessage, reset } = useAgentResponseAccumulator({ topic: \"agent\" });\n *\n * // In your WebSocket handler:\n * websocket.onmessage = (event) => {\n * handleMessage(JSON.parse(event.data));\n * };\n */\nexport function useAgentResponseAccumulator(\n options?: UseAgentResponseAccumulatorOptions\n): UseAgentResponseAccumulatorReturn {\n const [state, setState] = useState<AgentResponseState>(initialAgentResponseState);\n const topic = options?.topic;\n\n const handleMessage = useCallback(\n (message: unknown) => {\n // If topic filter is provided, check for matching topic\n let payload: AgentMessage;\n\n if (topic) {\n const msg = message as GenericWebSocketMessage;\n if (msg.topic !== topic) return;\n payload = msg.message;\n } else {\n // Assume message is the payload directly\n payload = message as AgentMessage;\n }\n\n setState((prev) => {\n // If we receive a non-status message while idle, transition to processing\n let newStatus = prev.status;\n const isFirstMessage = prev.status === \"idle\" && payload.type !== \"status\";\n if (isFirstMessage) {\n newStatus = \"processing\";\n }\n\n // Track first message time for total time calculation\n const firstMessageTime =\n prev.firstMessageTime ?? (isFirstMessage ? Date.now() : null);\n\n switch (payload.type) {\n case \"status\":\n // \"Harness connected\" resets to idle\n if (\n payload.message === \"Harness connected\" ||\n payload.status === \"Harness connected\"\n ) {\n return { ...initialAgentResponseState };\n }\n return { ...prev, status: newStatus };\n\n case \"thinking\": {\n // Check if this is a structured thinking step\n if (payload.thinkingStep) {\n const newStep: ThinkingStep = {\n id: payload.thinkingStep.id || `step-${Date.now()}`,\n label: payload.thinkingStep.label,\n content: payload.thinkingStep.content,\n depth: payload.thinkingStep.depth ?? 0,\n isCollapsed: payload.thinkingStep.isCollapsed,\n };\n const thinkingStartTime = prev.thinkingStartTime ?? Date.now();\n return {\n ...prev,\n status: newStatus,\n thinkingSteps: [...(prev.thinkingSteps || []), newStep],\n thinkingStartTime,\n firstMessageTime,\n };\n }\n\n // Plain text thinking (existing behavior)\n const newThinking = payload.message || payload.content || \"\";\n // Add line break between thinking messages\n const separator = prev.thinking && newThinking ? \"\\n\\n\" : \"\";\n // Set thinkingStartTime on first thinking message\n const thinkingStartTime =\n prev.thinkingStartTime ?? (newThinking ? Date.now() : null);\n return {\n ...prev,\n status: newStatus,\n thinking: prev.thinking + separator + newThinking,\n thinkingStartTime,\n firstMessageTime,\n };\n }\n\n case \"tool_call\": {\n // Handle both formats: { message: \"ToolName\" } or { tool: { id, name, arguments } }\n const toolName = payload.message || payload.tool?.name;\n if (toolName) {\n const newToolCall: ToolCall = {\n id: payload.tool?.id || `tool-${Date.now()}`,\n name: toolName,\n arguments: payload.tool?.arguments,\n timestamp: Date.now(),\n };\n return {\n ...prev,\n status: newStatus,\n toolCalls: [...prev.toolCalls, newToolCall],\n firstMessageTime,\n };\n }\n return { ...prev, status: newStatus, firstMessageTime };\n }\n\n case \"knowledge\": {\n // Handle both formats: { message: \"content\" } or { knowledge: { id, source, content } }\n const knowledgeContent = payload.message || payload.knowledge?.content;\n if (knowledgeContent) {\n const newKnowledge: KnowledgeItem = {\n id: payload.knowledge?.id || `knowledge-${Date.now()}`,\n source: payload.knowledge?.source || \"unknown\",\n content: knowledgeContent,\n timestamp: Date.now(),\n };\n return {\n ...prev,\n status: newStatus,\n knowledge: [...prev.knowledge, newKnowledge],\n firstMessageTime,\n };\n }\n return { ...prev, status: newStatus, firstMessageTime };\n }\n\n case \"memory\": {\n // Handle both formats: { message: \"content\" } or { memory: { id, type, content } }\n const memoryContent = payload.message || payload.memory?.content;\n if (memoryContent) {\n const newMemory: MemoryItem = {\n id: payload.memory?.id || `memory-${Date.now()}`,\n type: payload.memory?.type || \"unknown\",\n content: memoryContent,\n timestamp: Date.now(),\n };\n return {\n ...prev,\n status: newStatus,\n memory: [...prev.memory, newMemory],\n firstMessageTime,\n };\n }\n return { ...prev, status: newStatus, firstMessageTime };\n }\n\n case \"response\":\n return {\n ...prev,\n status: \"complete\",\n response: payload.message || payload.content || \"\",\n responseCompleteTime: Date.now(),\n firstMessageTime: prev.firstMessageTime ?? Date.now(),\n };\n\n case \"status_update\": {\n const statusMessage = payload.message || payload.statusUpdate?.message;\n if (statusMessage) {\n const newStatusItem: StatusItem = {\n id: payload.statusUpdate?.id || `status-${Date.now()}`,\n message: statusMessage,\n agent: payload.statusUpdate?.agent,\n timestamp: Date.now(),\n };\n return {\n ...prev,\n status: newStatus,\n statusUpdates: [...prev.statusUpdates, newStatusItem],\n firstMessageTime,\n };\n }\n return { ...prev, status: newStatus, firstMessageTime };\n }\n\n default:\n return { ...prev, status: newStatus, firstMessageTime };\n }\n });\n },\n [topic]\n );\n\n const reset = useCallback(() => {\n setState(initialAgentResponseState);\n }, []);\n\n return { state, handleMessage, reset };\n}\n","/**\n * AgentResponse Component\n *\n * A library-ready presentational component for displaying AI agent responses.\n * Displays thinking, tool calls, knowledge retrieval, memory access, and final response.\n */\n\nimport * as React from \"react\";\nimport { useState, useMemo, useCallback } from \"react\";\nimport { cn } from \"@optilogic/core\";\nimport { MetadataRow, ThinkingSection, ActionBar, HITLSection } from \"./components\";\nimport { useThinkingTimer } from \"./hooks\";\nimport type { AgentResponseState, FeedbackValue } from \"./types\";\nimport type { HITLInteraction } from \"../hitl-interactions\";\n\nexport interface AgentResponseProps extends React.HTMLAttributes<HTMLDivElement> {\n /** The response state to render */\n state: AgentResponseState;\n\n /** Optional unique ID (for list keys) */\n id?: string;\n\n /** Optional timestamp to display */\n timestamp?: Date;\n\n /** Feedback state (controlled) */\n feedback?: FeedbackValue;\n onFeedbackChange?: (feedback: FeedbackValue) => void;\n\n /** Callback when the response is copied via the action bar */\n onResponseCopy?: (response: string) => void;\n\n /** Thinking section expansion (controlled or uncontrolled) */\n defaultThinkingExpanded?: boolean;\n thinkingExpanded?: boolean;\n onThinkingExpandedChange?: (expanded: boolean) => void;\n\n /** Action bar visibility mode */\n actionsVisible?: boolean | \"hover\";\n\n /**\n * Optional HITL (Human-in-the-Loop) interactions to display as a\n * collapsible section within the response. When provided, a \"Clarifying\n * Questions\" section appears between the thinking/metadata area and\n * the response content.\n */\n hitlInteractions?: HITLInteraction[];\n\n /** Whether the HITL section starts expanded (default: false) */\n defaultHITLExpanded?: boolean;\n\n /**\n * Optional content to display in the MetadataRow's middle area,\n * between the thinking toggle (left) and activity indicators (right).\n * Typically used for ephemeral status messages during processing.\n * The parent is responsible for setting and clearing this content.\n *\n * @example\n * <AgentResponse\n * state={state}\n * statusContent={\n * state.status !== 'complete'\n * ? <TruncatedMessage message=\"Analyzing data...\" />\n * : undefined\n * }\n * />\n */\n statusContent?: React.ReactNode;\n\n /**\n * Custom markdown renderer for the response content.\n * If not provided, the response will be rendered as plain text.\n *\n * @example\n * <AgentResponse\n * state={state}\n * renderMarkdown={(content) => <MyMarkdownRenderer content={content} />}\n * />\n */\n renderMarkdown?: (content: string) => React.ReactNode;\n\n /**\n * Custom markdown renderer for the thinking content.\n * If not provided, the thinking will be rendered as plain preformatted text.\n *\n * @example\n * <AgentResponse\n * state={state}\n * renderThinkingMarkdown={(content) => <MyMarkdownRenderer content={content} />}\n * />\n */\n renderThinkingMarkdown?: (content: string) => React.ReactNode;\n}\n\n/**\n * AgentResponse Component\n *\n * A complete component for displaying AI agent responses including:\n * - Thinking/reasoning content (collapsible)\n * - Tool calls, knowledge retrieval, and memory access indicators\n * - Final response with optional markdown rendering\n * - Action bar with copy and feedback buttons\n *\n * @example\n * // Basic usage with useAgentResponseAccumulator hook\n * const { state, handleMessage } = useAgentResponseAccumulator();\n *\n * <AgentResponse state={state} />\n *\n * @example\n * // With markdown rendering and feedback\n * <AgentResponse\n * state={state}\n * renderMarkdown={(content) => <ReactMarkdown>{content}</ReactMarkdown>}\n * feedback={feedback}\n * onFeedbackChange={setFeedback}\n * />\n *\n * @example\n * // Controlled thinking expansion\n * <AgentResponse\n * state={state}\n * thinkingExpanded={isExpanded}\n * onThinkingExpandedChange={setIsExpanded}\n * />\n */\nconst AgentResponse = React.forwardRef<HTMLDivElement, AgentResponseProps>(\n (\n {\n state,\n id,\n timestamp,\n feedback,\n onFeedbackChange,\n onResponseCopy,\n defaultThinkingExpanded = false,\n thinkingExpanded: controlledThinkingExpanded,\n onThinkingExpandedChange,\n actionsVisible = \"hover\",\n hitlInteractions,\n defaultHITLExpanded = false,\n statusContent,\n renderMarkdown,\n renderThinkingMarkdown,\n className,\n ...props\n },\n ref\n ) => {\n // Uncontrolled thinking expanded state\n const [uncontrolledExpanded, setUncontrolledExpanded] = useState(defaultThinkingExpanded);\n\n // Determine if thinking is controlled\n const isThinkingControlled = controlledThinkingExpanded !== undefined;\n const thinkingExpanded = isThinkingControlled\n ? controlledThinkingExpanded\n : uncontrolledExpanded;\n\n // Toggle thinking handler\n const toggleThinking = useCallback(() => {\n const newValue = !thinkingExpanded;\n if (isThinkingControlled) {\n onThinkingExpandedChange?.(newValue);\n } else {\n setUncontrolledExpanded(newValue);\n }\n }, [thinkingExpanded, isThinkingControlled, onThinkingExpandedChange]);\n\n // Hover state for action bar visibility\n const [isHovered, setIsHovered] = useState(false);\n\n // Thinking timer\n const elapsedTime = useThinkingTimer({\n startTime: state.thinkingStartTime,\n endTime: state.responseCompleteTime,\n status: state.status,\n });\n\n // Calculate total time (from first message to response complete)\n const totalTimeSeconds = useMemo(() => {\n if (!state.firstMessageTime || !state.responseCompleteTime) return 0;\n return (state.responseCompleteTime - state.firstMessageTime) / 1000;\n }, [state.firstMessageTime, state.responseCompleteTime]);\n\n // Check if we have any thinking content (plain text or structured)\n const hasThinkingContent =\n !!state.thinking || (state.thinkingSteps && state.thinkingSteps.length > 0) || false;\n\n const hasHITLInteractions =\n hitlInteractions && hitlInteractions.length > 0;\n\n // Derived state: has any content been received?\n const hasAnyContent =\n hasThinkingContent ||\n state.toolCalls.length > 0 ||\n state.knowledge.length > 0 ||\n state.memory.length > 0 ||\n state.statusUpdates.length > 0 ||\n hasHITLInteractions ||\n state.response;\n\n // Derived state: should show metadata row?\n const showMetadataRow =\n hasThinkingContent ||\n state.toolCalls.length > 0 ||\n state.knowledge.length > 0 ||\n state.memory.length > 0 ||\n state.statusUpdates.length > 0 ||\n state.status === \"processing\";\n\n // Determine action bar visibility\n const showActionBar = state.status === \"complete\" && state.response;\n const isActionBarVisible =\n actionsVisible === true ||\n (actionsVisible === \"hover\" && isHovered);\n\n // If no content, render nothing\n if (!hasAnyContent) {\n return null;\n }\n\n return (\n <div\n ref={ref}\n className={className}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n {...props}\n >\n {/* Message Content Container */}\n <div className=\"border border-border rounded-lg overflow-hidden\">\n {/* Metadata Row - show if there's any metadata or thinking */}\n {showMetadataRow && (\n <>\n <MetadataRow\n hasThinking={hasThinkingContent}\n isExpanded={thinkingExpanded}\n onToggle={toggleThinking}\n toolCalls={state.toolCalls}\n knowledge={state.knowledge}\n memory={state.memory}\n statusUpdates={state.statusUpdates}\n statusContent={statusContent}\n status={state.status}\n elapsedTime={elapsedTime}\n />\n\n {/* Thinking Content - collapsible with max-height */}\n <ThinkingSection\n content={\n state.thinkingSteps && state.thinkingSteps.length > 0\n ? state.thinkingSteps\n : state.thinking\n }\n isExpanded={thinkingExpanded}\n renderMarkdown={renderThinkingMarkdown}\n />\n </>\n )}\n\n {/* HITL Interactions - collapsible section */}\n {hasHITLInteractions && (\n <HITLSection\n interactions={hitlInteractions}\n defaultExpanded={defaultHITLExpanded}\n />\n )}\n\n {/* Response Section */}\n {state.response && (\n <div\n className={cn(\n \"bg-muted/50 p-4\",\n showMetadataRow && \"border-t border-border\"\n )}\n >\n {renderMarkdown ? (\n renderMarkdown(state.response)\n ) : (\n <span className=\"whitespace-pre-wrap\">{state.response}</span>\n )}\n </div>\n )}\n </div>\n\n {/* Action Bar - outside the message container, visible on hover when complete */}\n {showActionBar && (\n <ActionBar\n response={state.response}\n isVisible={isActionBarVisible}\n totalTimeSeconds={totalTimeSeconds}\n feedback={feedback}\n onFeedbackChange={onFeedbackChange}\n onResponseCopy={onResponseCopy}\n />\n )}\n </div>\n );\n }\n);\nAgentResponse.displayName = \"AgentResponse\";\n\nexport { AgentResponse };\n","import * as React from \"react\";\nimport { cn } from \"@optilogic/core\";\n\nexport interface UserPromptProps extends React.HTMLAttributes<HTMLDivElement> {\n /** The text content of the user's message */\n content: string;\n /** Optional timestamp to display below the message */\n timestamp?: Date;\n}\n\n/**\n * UserPrompt component\n *\n * Displays a user's chat message in a styled bubble.\n * Used alongside AgentResponse to create chat interfaces.\n *\n * @example\n * ```tsx\n * <UserPrompt\n * content=\"What is the weather today?\"\n * timestamp={new Date()}\n * />\n * ```\n *\n * @example\n * ```tsx\n * // Custom styling\n * <UserPrompt\n * content=\"Hello world\"\n * className=\"max-w-full\"\n * />\n * ```\n */\nexport const UserPrompt = React.forwardRef<HTMLDivElement, UserPromptProps>(\n ({ content, timestamp, className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\n \"w-fit max-w-[80%] rounded-lg px-4 pt-3.5 pb-3\",\n \"bg-secondary text-secondary-foreground\",\n className\n )}\n {...props}\n >\n <p className=\"whitespace-pre-wrap\">{content}</p>\n {timestamp && (\n <p className=\"text-xs text-secondary-foreground/70 mt-1\">\n {timestamp.toLocaleTimeString([], {\n hour: \"2-digit\",\n minute: \"2-digit\",\n })}\n </p>\n )}\n </div>\n );\n }\n);\n\nUserPrompt.displayName = \"UserPrompt\";\n","import * as React from \"react\";\nimport { Send, Loader2, Square } from \"lucide-react\";\nimport { cn, IconButton } from \"@optilogic/core\";\nimport {\n SlateEditor,\n Text,\n type SlateEditorRef,\n type NodeEntry,\n type DecoratedRange,\n type RenderLeafProps,\n} from \"@optilogic/editor\";\nimport type { UserPromptInputProps, UserPromptInputRef } from \"./types\";\n\n/**\n * Creates a decorate function that highlights code blocks.\n * Handles both complete (```...```) and unclosed (```...) code blocks.\n */\nfunction createCodeBlockDecorate(entry: NodeEntry): DecoratedRange[] {\n const [node, path] = entry;\n const ranges: DecoratedRange[] = [];\n\n if (!Text.isText(node)) {\n return ranges;\n }\n\n const { text } = node;\n\n // Find all ``` positions\n const backtickPositions: number[] = [];\n let searchStart = 0;\n while (true) {\n const pos = text.indexOf(\"```\", searchStart);\n if (pos === -1) break;\n backtickPositions.push(pos);\n searchStart = pos + 3;\n }\n\n // Process pairs of backticks (and handle unclosed blocks)\n let i = 0;\n while (i < backtickPositions.length) {\n const openPos = backtickPositions[i];\n const closePos = backtickPositions[i + 1];\n\n // Mark opening delimiter\n ranges.push({\n anchor: { path, offset: openPos },\n focus: { path, offset: openPos + 3 },\n codeDelimiter: true,\n } as DecoratedRange);\n\n if (closePos !== undefined) {\n // Complete code block - mark content and closing delimiter\n if (closePos > openPos + 3) {\n ranges.push({\n anchor: { path, offset: openPos + 3 },\n focus: { path, offset: closePos },\n codeBlock: true,\n } as DecoratedRange);\n }\n ranges.push({\n anchor: { path, offset: closePos },\n focus: { path, offset: closePos + 3 },\n codeDelimiter: true,\n } as DecoratedRange);\n i += 2; // Move past both opening and closing\n } else {\n // Unclosed code block - mark everything to end as code\n if (text.length > openPos + 3) {\n ranges.push({\n anchor: { path, offset: openPos + 3 },\n focus: { path, offset: text.length },\n codeBlock: true,\n } as DecoratedRange);\n }\n i += 1; // Move past opening only\n }\n }\n\n return ranges;\n}\n\n/**\n * Custom leaf renderer for code block styling\n */\nfunction CodeBlockLeaf({ attributes, children, leaf }: RenderLeafProps) {\n const leafAny = leaf as { codeBlock?: boolean; codeDelimiter?: boolean };\n\n if (leafAny.codeBlock) {\n return (\n <span\n {...attributes}\n className=\"bg-muted/50 text-muted-foreground font-mono text-sm rounded px-1\"\n >\n {children}\n </span>\n );\n }\n\n if (leafAny.codeDelimiter) {\n return (\n <span\n {...attributes}\n className=\"text-muted-foreground/50 font-mono text-sm\"\n >\n {children}\n </span>\n );\n }\n\n return <span {...attributes}>{children}</span>;\n}\n\n/**\n * UserPromptInput Component\n *\n * A rich text input for user messages that wraps SlateEditor.\n * Features:\n * - Code block styling with triple backticks\n * - Send button with loading state\n * - Action slot for additional buttons\n * - Tag support (optional)\n *\n * @example\n * <UserPromptInput\n * placeholder=\"Type your message...\"\n * onSubmit={(text) => sendMessage(text)}\n * renderActions={() => (\n * <IconButton icon={<Paperclip />} aria-label=\"Attach file\" />\n * )}\n * />\n */\nexport const UserPromptInput = React.forwardRef<\n UserPromptInputRef,\n UserPromptInputProps\n>(\n (\n {\n value = \"\",\n onChange,\n onSubmit,\n clearOnSubmit = true,\n placeholder = \"Type your message...\",\n disabled = false,\n isSubmitting = false,\n onStop,\n disableWhileSubmitting = true,\n autoFocus = false,\n refocusAfterSubmit = false,\n onReady,\n minRows = 1,\n maxRows = 6,\n renderActions,\n enableTags = false,\n onTagCreate,\n onTagDelete,\n className,\n ...props\n },\n ref\n ) => {\n const editorRef = React.useRef<SlateEditorRef>(null);\n const [internalValue, setInternalValue] = React.useState(value);\n const prevIsSubmitting = React.useRef(isSubmitting);\n const hasEmittedReady = React.useRef(false);\n\n // Sync internal value with prop\n React.useEffect(() => {\n setInternalValue(value);\n }, [value]);\n\n // Handle autoFocus - use double RAF to ensure Slate is fully initialized\n React.useEffect(() => {\n if (autoFocus) {\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n editorRef.current?.focus();\n });\n });\n }\n }, [autoFocus]);\n\n // Emit onReady callback when editor is initialized\n React.useEffect(() => {\n if (!hasEmittedReady.current && onReady) {\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n hasEmittedReady.current = true;\n onReady();\n });\n });\n }\n }, [onReady]);\n\n // Refocus after submit completes\n React.useEffect(() => {\n if (refocusAfterSubmit && prevIsSubmitting.current && !isSubmitting) {\n requestAnimationFrame(() => {\n editorRef.current?.focus();\n });\n }\n prevIsSubmitting.current = isSubmitting;\n }, [isSubmitting, refocusAfterSubmit]);\n\n // Expose ref methods\n React.useImperativeHandle(\n ref,\n () => ({\n focus: () => {\n try {\n editorRef.current?.focus();\n } catch {\n // Retry after Slate initializes (handles early calls)\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n editorRef.current?.focus();\n });\n });\n }\n },\n clear: () => {\n editorRef.current?.clear();\n setInternalValue(\"\");\n },\n getText: () => editorRef.current?.getText() ?? \"\",\n insertText: (text: string) => editorRef.current?.insertText(text),\n }),\n []\n );\n\n const handleChange = React.useCallback(\n (newValue: string) => {\n setInternalValue(newValue);\n onChange?.(newValue);\n },\n [onChange]\n );\n\n const handleSubmit = React.useCallback(\n (text: string) => {\n if (disabled || isSubmitting) return;\n if (!text.trim()) return;\n\n onSubmit?.(text.trim());\n\n if (clearOnSubmit) {\n editorRef.current?.clear();\n setInternalValue(\"\");\n }\n },\n [disabled, isSubmitting, onSubmit, clearOnSubmit]\n );\n\n const handleSendClick = React.useCallback(() => {\n const text = editorRef.current?.getText() ?? \"\";\n handleSubmit(text);\n }, [handleSubmit]);\n\n const hasContent = internalValue.trim().length > 0;\n const canSubmit = hasContent && !disabled && !isSubmitting;\n\n return (\n <div\n className={cn(\n \"rounded-lg border border-input bg-background\",\n disabled && \"opacity-50 cursor-not-allowed\",\n className\n )}\n {...props}\n >\n {/* Editor area */}\n <div className=\"pl-2 pr-0 pt-1 pb-1\">\n <SlateEditor\n ref={editorRef}\n value={internalValue}\n onChange={handleChange}\n onSubmit={handleSubmit}\n clearOnSubmit={false}\n placeholder={placeholder}\n disabled={disabled || (disableWhileSubmitting && isSubmitting)}\n enableTags={enableTags}\n onTagCreate={onTagCreate}\n onTagDelete={onTagDelete}\n minRows={minRows}\n maxRows={maxRows}\n decorate={createCodeBlockDecorate}\n renderLeaf={CodeBlockLeaf}\n />\n </div>\n\n {/* Actions row */}\n <div className=\"flex items-center justify-between pl-2 pr-1 pb-1 pt-1\">\n {/* Left actions slot */}\n <div className=\"flex items-center gap-1\">{renderActions?.()}</div>\n\n {/* Send/Stop button */}\n {isSubmitting && onStop ? (\n <IconButton\n icon={<Square />}\n variant=\"filled\"\n size=\"sm\"\n aria-label=\"Stop\"\n onClick={onStop}\n />\n ) : (\n <IconButton\n icon={\n isSubmitting ? (\n <Loader2 className=\"animate-spin\" />\n ) : (\n <Send />\n )\n }\n variant=\"filled\"\n size=\"sm\"\n aria-label={isSubmitting ? \"Sending...\" : \"Send message\"}\n disabled={!canSubmit}\n onClick={handleSendClick}\n />\n )}\n </div>\n </div>\n );\n }\n);\n\nUserPromptInput.displayName = \"UserPromptInput\";\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optilogic/chat",
3
- "version": "1.0.0-beta.1",
3
+ "version": "1.0.0-beta.10",
4
4
  "description": "Chat UI components for Optilogic - AgentResponse and related components for LLM interactions",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -24,19 +24,25 @@
24
24
  "README.md"
25
25
  ],
26
26
  "dependencies": {
27
- "@optilogic/core": "1.0.0-beta.1"
27
+ "@optilogic/core": "1.0.0-beta.10",
28
+ "@optilogic/editor": "1.0.0-beta.10"
28
29
  },
29
30
  "peerDependencies": {
30
- "lucide-react": "^0.400.0",
31
31
  "react": "^18.0.0 || ^19.0.0",
32
- "react-dom": "^18.0.0 || ^19.0.0"
32
+ "react-dom": "^18.0.0 || ^19.0.0",
33
+ "slate": ">=0.100.0",
34
+ "slate-history": ">=0.100.0",
35
+ "slate-react": ">=0.100.0"
33
36
  },
34
37
  "devDependencies": {
35
- "@types/react": "^18.3.0",
36
- "@types/react-dom": "^18.3.0",
37
- "lucide-react": "^0.468.0",
38
- "react": "^18.3.1",
39
- "react-dom": "^18.3.1",
38
+ "@types/react": "^19.0.0",
39
+ "@types/react-dom": "^19.0.0",
40
+ "lucide-react": "^0.563.0",
41
+ "react": "^19.0.0",
42
+ "react-dom": "^19.0.0",
43
+ "slate": "^0.123.0",
44
+ "slate-history": "^0.113.1",
45
+ "slate-react": "^0.123.0",
40
46
  "tsup": "^8.3.5",
41
47
  "typescript": "^5.7.2"
42
48
  },
@@ -8,9 +8,10 @@
8
8
  import * as React from "react";
9
9
  import { useState, useMemo, useCallback } from "react";
10
10
  import { cn } from "@optilogic/core";
11
- import { MetadataRow, ThinkingSection, ActionBar } from "./components";
11
+ import { MetadataRow, ThinkingSection, ActionBar, HITLSection } from "./components";
12
12
  import { useThinkingTimer } from "./hooks";
13
13
  import type { AgentResponseState, FeedbackValue } from "./types";
14
+ import type { HITLInteraction } from "../hitl-interactions";
14
15
 
15
16
  export interface AgentResponseProps extends React.HTMLAttributes<HTMLDivElement> {
16
17
  /** The response state to render */
@@ -37,6 +38,35 @@ export interface AgentResponseProps extends React.HTMLAttributes<HTMLDivElement>
37
38
  /** Action bar visibility mode */
38
39
  actionsVisible?: boolean | "hover";
39
40
 
41
+ /**
42
+ * Optional HITL (Human-in-the-Loop) interactions to display as a
43
+ * collapsible section within the response. When provided, a "Clarifying
44
+ * Questions" section appears between the thinking/metadata area and
45
+ * the response content.
46
+ */
47
+ hitlInteractions?: HITLInteraction[];
48
+
49
+ /** Whether the HITL section starts expanded (default: false) */
50
+ defaultHITLExpanded?: boolean;
51
+
52
+ /**
53
+ * Optional content to display in the MetadataRow's middle area,
54
+ * between the thinking toggle (left) and activity indicators (right).
55
+ * Typically used for ephemeral status messages during processing.
56
+ * The parent is responsible for setting and clearing this content.
57
+ *
58
+ * @example
59
+ * <AgentResponse
60
+ * state={state}
61
+ * statusContent={
62
+ * state.status !== 'complete'
63
+ * ? <TruncatedMessage message="Analyzing data..." />
64
+ * : undefined
65
+ * }
66
+ * />
67
+ */
68
+ statusContent?: React.ReactNode;
69
+
40
70
  /**
41
71
  * Custom markdown renderer for the response content.
42
72
  * If not provided, the response will be rendered as plain text.
@@ -48,6 +78,18 @@ export interface AgentResponseProps extends React.HTMLAttributes<HTMLDivElement>
48
78
  * />
49
79
  */
50
80
  renderMarkdown?: (content: string) => React.ReactNode;
81
+
82
+ /**
83
+ * Custom markdown renderer for the thinking content.
84
+ * If not provided, the thinking will be rendered as plain preformatted text.
85
+ *
86
+ * @example
87
+ * <AgentResponse
88
+ * state={state}
89
+ * renderThinkingMarkdown={(content) => <MyMarkdownRenderer content={content} />}
90
+ * />
91
+ */
92
+ renderThinkingMarkdown?: (content: string) => React.ReactNode;
51
93
  }
52
94
 
53
95
  /**
@@ -95,7 +137,11 @@ const AgentResponse = React.forwardRef<HTMLDivElement, AgentResponseProps>(
95
137
  thinkingExpanded: controlledThinkingExpanded,
96
138
  onThinkingExpandedChange,
97
139
  actionsVisible = "hover",
140
+ hitlInteractions,
141
+ defaultHITLExpanded = false,
142
+ statusContent,
98
143
  renderMarkdown,
144
+ renderThinkingMarkdown,
99
145
  className,
100
146
  ...props
101
147
  },
@@ -136,20 +182,30 @@ const AgentResponse = React.forwardRef<HTMLDivElement, AgentResponseProps>(
136
182
  return (state.responseCompleteTime - state.firstMessageTime) / 1000;
137
183
  }, [state.firstMessageTime, state.responseCompleteTime]);
138
184
 
185
+ // Check if we have any thinking content (plain text or structured)
186
+ const hasThinkingContent =
187
+ !!state.thinking || (state.thinkingSteps && state.thinkingSteps.length > 0) || false;
188
+
189
+ const hasHITLInteractions =
190
+ hitlInteractions && hitlInteractions.length > 0;
191
+
139
192
  // Derived state: has any content been received?
140
193
  const hasAnyContent =
141
- state.thinking ||
194
+ hasThinkingContent ||
142
195
  state.toolCalls.length > 0 ||
143
196
  state.knowledge.length > 0 ||
144
197
  state.memory.length > 0 ||
198
+ state.statusUpdates.length > 0 ||
199
+ hasHITLInteractions ||
145
200
  state.response;
146
201
 
147
202
  // Derived state: should show metadata row?
148
203
  const showMetadataRow =
149
- state.thinking ||
204
+ hasThinkingContent ||
150
205
  state.toolCalls.length > 0 ||
151
206
  state.knowledge.length > 0 ||
152
207
  state.memory.length > 0 ||
208
+ state.statusUpdates.length > 0 ||
153
209
  state.status === "processing";
154
210
 
155
211
  // Determine action bar visibility
@@ -177,24 +233,39 @@ const AgentResponse = React.forwardRef<HTMLDivElement, AgentResponseProps>(
177
233
  {showMetadataRow && (
178
234
  <>
179
235
  <MetadataRow
180
- hasThinking={!!state.thinking}
236
+ hasThinking={hasThinkingContent}
181
237
  isExpanded={thinkingExpanded}
182
238
  onToggle={toggleThinking}
183
239
  toolCalls={state.toolCalls}
184
240
  knowledge={state.knowledge}
185
241
  memory={state.memory}
242
+ statusUpdates={state.statusUpdates}
243
+ statusContent={statusContent}
186
244
  status={state.status}
187
245
  elapsedTime={elapsedTime}
188
246
  />
189
247
 
190
248
  {/* Thinking Content - collapsible with max-height */}
191
249
  <ThinkingSection
192
- content={state.thinking}
250
+ content={
251
+ state.thinkingSteps && state.thinkingSteps.length > 0
252
+ ? state.thinkingSteps
253
+ : state.thinking
254
+ }
193
255
  isExpanded={thinkingExpanded}
256
+ renderMarkdown={renderThinkingMarkdown}
194
257
  />
195
258
  </>
196
259
  )}
197
260
 
261
+ {/* HITL Interactions - collapsible section */}
262
+ {hasHITLInteractions && (
263
+ <HITLSection
264
+ interactions={hitlInteractions}
265
+ defaultExpanded={defaultHITLExpanded}
266
+ />
267
+ )}
268
+
198
269
  {/* Response Section */}
199
270
  {state.response && (
200
271
  <div