'use client' import { useMemo } from 'react' import Link from 'next/link' import { ArrowLeft } from 'lucide-react' import AgentChat, { normalizeStoredMessages } from './AgentChat' import AgentAvatar from './AgentAvatar' import SandboxAgentPreview from './SandboxAgentPreview' import { useAgentSheet } from './AgentSheetProvider' import { useCompanyOptional } from '@/contexts/CompanyContext' interface Props { conversationId: string intentId: string contextRef: string | null title: string rawMessages: { role: string; content: unknown; hidden?: boolean }[] } // Full-page conversation view. Wraps AgentChat with a header that shows the // title (or intent label). AgentChat handles the streaming + input + render. export default function ChatConversationView({ conversationId, intentId, contextRef, title, rawMessages, }: Props) { const initialMessages = useMemo(() => normalizeStoredMessages(rawMessages), [rawMessages]) const { identity } = useAgentSheet() const companyCtx = useCompanyOptional() const isSandbox = companyCtx?.isSandbox ?? false const agentName = identity.displayName?.trim() || null return ( <>
{/* Mobile-only back-to-list arrow. On desktop the sidebar is always visible so a back button would be redundant. */}

{title}

{contextRef && (

{contextRef}

)}
{isSandbox ? ( ) : ( )}
) }