feat: add Mastra support (adapter, message format, example app)#369
feat: add Mastra support (adapter, message format, example app)#369askadityapandey wants to merge 3 commits intothesysdev:mainfrom
Conversation
rabisg
left a comment
There was a problem hiding this comment.
I tried running it locally but couldn't. Please attach a screenshot/gif of a working request response in the PR description to help us with the review
| "dist", | ||
| "README.md" | ||
| ], | ||
| "scripts": { |
There was a problem hiding this comment.
there shouldn't be any changes needed in this PR for any of the packages/**
can you please clean them up
rabisg
left a comment
There was a problem hiding this comment.
@askadityapandey We don't mind if you use AI coding tools - we all do. But reviewing each PR takes a lot of time and effort so please review your PR manually once before sending it for review.
There are a bunch of unrelated changes, deleting entire files in the core package - the motivation for which is unclear. I have a strong feeling you've not even looked at the generated code once before sending it for review
644f903 to
0c72a7b
Compare
0c72a7b to
5d36913
Compare
e62fc8a to
f34b4f7
Compare
What
Adds native Mastra support to OpenUI so developers can connect a Mastra agent backend to OpenUI's streaming renderer and chat interfaces without writing custom integration code.
Closes #295
Changes
@openuidev/react-headlessimplements StreamProtocolAdapter, parses Mastra's AI SDK SSE stream intoAGUIEvents including text deltas and tool call start/args/end events. Uses a persistent buffer across TCP chunk reads to handle split SSE frames correctly.mastraMessageFormatto@openuidev/react-headlessimplements MessageFormat, converts OpenUI's internal message history to Mastra's expected shape (handles text, image_url, and multipart content) and maps responses back.examples/mastra-chata standalone Next.js app following the same structure asexamples/openui-chat, demonstrating a real MastraAgentwithcreateTooltools wired to OpenUI's<FullScreen />viastreamProtocol={mastraAdapter()}andmastraMessageFormat.Test Plan
Verified locally examples/mastra-chat runs with OPENAI_API_KEY set, text streams correctly, tool calls are intercepted and rendered
pnpm --filter mastra-chat devChecklist
This is a purely additive change no existing adapters or formats are touched. Completely backwards compatible.