// Mirrors examples/with-react-ink/src/components/thread.tsx; keep in sync. import { Box, Text, useStdout } from "ink"; import { ThreadPrimitive, ComposerPrimitive, MessagePrimitive, ErrorPrimitive, LoadingPrimitive, LiveChecklist, } from "@assistant-ui/react-ink"; import { MarkdownText } from "@assistant-ui/react-ink-markdown"; // markdansi defaults width and color from process.stdout, which does not // exist in the browser bundle; pass both explicitly so it never reads it. // color is forwarded to markdansi but not yet declared on MarkdownTextProps. const BrowserMarkdownText = ({ text }: { text: string }) => { const { stdout } = useStdout(); return ( ); }; const UserMessage = () => ( You:{" "} {part.text}} /> ); const AssistantMessage = () => ( AI: } renderReasoning={({ part }) => ( {part.text} )} /> ); const Loading = () => ( Working ); export const Thread = () => { return ( A real LLM streaming into a real Ink render loop in your browser. {' try: "what is assistant-ui?" or "how do I render markdown?"'} {({ message }) => message.role === "user" ? : } {"> "} ); };