{"$schema":"https:\/\/ui.particle.academy\/schema\/registry-item.json","name":"teachers-aid-chat","type":"registry:ui","title":"TeachersAidChat","description":"The whole surface \u2014 transcript, composer and plan review in one.","package":"teachers-aid-ui","dependencies":["@particle-academy\/react-fancy"],"registryDependencies":["types"],"files":[{"path":"components\/fancy\/teachers-aid-chat\/TeachersAidChat.tsx","content":"import { Text } from '@particle-academy\/react-fancy';\r\nimport { ChatTranscript } from '.\/ChatTranscript';\r\nimport { MessageComposer } from '.\/MessageComposer';\r\nimport { PlanReview } from '.\/PlanReview';\r\nimport type { ChangePlan, ChatEntry } from '..\/types';\r\n\r\nexport interface TeachersAidChatProps {\r\n    agentName: string;\r\n    history: ChatEntry[];\r\n    plan?: ChangePlan | null;\r\n    onSend: (message: string, files: File[], reset: () => void) => void;\r\n    onApply: () => void;\r\n    onDiscard: () => void;\r\n    onReset?: () => void;\r\n    \/** A turn or a plan action is in flight. *\/\r\n    busy?: boolean;\r\n    \/**\r\n     * Optimistic turn to append while the model works, so the transcript does\r\n     * not sit empty during a slow call.\r\n     *\/\r\n    pending?: ChatEntry | null;\r\n    \/** False disables input. Pair it with a banner saying why. *\/\r\n    configured?: boolean;\r\n    \/** Rendered above the plan \u2014 flash messages, key warnings, anything. *\/\r\n    banner?: React.ReactNode;\r\n    description?: React.ReactNode;\r\n    className?: string;\r\n}\r\n\r\n\/**\r\n * The whole Teachers Aid surface: plan review, transcript, composer.\r\n *\r\n * Fully controlled and transport-agnostic \u2014 it takes data and callbacks and\r\n * imports no router or HTTP client. The host owns how a message is sent, which\r\n * is what lets the same component sit on Inertia, a fetch call or a websocket.\r\n *\/\r\nexport function TeachersAidChat({\r\n    agentName,\r\n    history,\r\n    plan,\r\n    onSend,\r\n    onApply,\r\n    onDiscard,\r\n    onReset,\r\n    busy,\r\n    pending,\r\n    configured = true,\r\n    banner,\r\n    description,\r\n    className,\r\n}: TeachersAidChatProps) {\r\n    const transcript = pending ? [...history, pending] : history;\r\n\r\n    return (\r\n        <div className={`grid gap-4 ${className ?? ''}`}>\r\n            {description && <Text className=\"!text-sm !text-secondary-600\">{description}<\/Text>}\r\n\r\n            {banner}\r\n\r\n            <PlanReview plan={plan} busy={busy} onApply={onApply} onDiscard={onDiscard} \/>\r\n\r\n            <div className=\"flex min-h-[28rem] flex-col overflow-hidden rounded-lg border border-secondary-200 bg-white\">\r\n                <div className=\"flex items-center justify-between border-b border-secondary-200 px-4 py-2\">\r\n                    <Text className=\"!text-xs !font-semibold !uppercase !tracking-wide !text-secondary-500\">\r\n                        Conversation\r\n                    <\/Text>\r\n                    {onReset && history.length > 0 && (\r\n                        <button\r\n                            type=\"button\"\r\n                            onClick={onReset}\r\n                            disabled={busy}\r\n                            className=\"text-xs text-secondary-500 hover:text-primary-600 disabled:opacity-50\"\r\n                        >\r\n                            Clear conversation\r\n                        <\/button>\r\n                    )}\r\n                <\/div>\r\n\r\n                <ChatTranscript\r\n                    history={transcript}\r\n                    agentName={agentName}\r\n                    thinking={!!busy && !!pending}\r\n                \/>\r\n\r\n                <MessageComposer\r\n                    onSend={onSend}\r\n                    agentName={agentName}\r\n                    disabled={busy || !configured}\r\n                    busy={busy}\r\n                \/>\r\n            <\/div>\r\n        <\/div>\r\n    );\r\n}\r\n","type":"registry:ui","target":"components\/fancy\/teachers-aid-chat\/TeachersAidChat.tsx"}]}