// Renders an assistant message: markdown for prose, and a small "Ran N // actions" pill in place of any ```action``` fenced blocks (which are the // machine-readable instructions the bus has already executed). import { useMemo } from "react" import ReactMarkdown from "react-markdown" import { Sparkles } from "lucide-react" import { extractActionBlocks } from "@crema/action-bus" const ACTION_BLOCK_RE = /```action\s*\n[\s\S]*?```/g export function MessageBody({ content }: { content: string }) { const { prose, actionCount } = useMemo(() => { const blocks = extractActionBlocks(content) return { prose: content.replace(ACTION_BLOCK_RE, "").trim(), actionCount: blocks.length, } }, [content]) return (
{children}
, code: ({ children, className }) => { const isBlock = className?.startsWith("language-") if (isBlock) { return (
{children}
)
}
return (
{children}
)
},
ul: ({ children }) =>