Mastra
Use Mastra’s maintained UI-message bridge instead of a parallel Ghost message engine.
Return a v7 UI-message response
Install @mastra/ai-sdk@1.11.2 with its compatible @mastra/core peer. Keep the Mastra instance, agent and authentication on the server. The example uses version: "v7" explicitly to match Ghost's current Vercel recipe.
Supply validated request parameters from your server route. Preserve the returned response headers. Configure memory/resource/thread identity and tool policy in Mastra rather than accepting a client-selected privileged resource.
Render in React
Connect the Vercel recipe to your route with DefaultChatTransport. Its native hook owns UI messages; createAiSdkAdapter projects them into canonical views. Mastra's workflow and network bridges can use the same protocol route when their output fits UI messages; richer workflow state belongs in an application panel.
Extend and diagnose
Keep native run/thread IDs and resume data for approval/recovery. A local Ghost edit is not a Mastra memory rewrite. For a missing tool or sub-agent view, inspect native UI data parts and supply an intentional renderer rather than silently dropping them. Mismatched SDK/bridge versions can fail at stream decoding even when the endpoint returns 200.
See Mastra AI SDK UI for server routes, approval and memory configuration, and stability for checked frontend versions.