-
Notifications
You must be signed in to change notification settings - Fork 17
Fixing mastra backend in product roadmap example #170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ying thread controller to filter latest message
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Summary
This PR implements a major architectural refactoring to fix the Mastra backend integration in the product roadmap example. The changes consolidate backend functionality from scattered locations within src/app/examples/ into a centralized examples-backend/product-roadmap-backend/ directory structure.
Key changes include:
Backend Consolidation: The product roadmap backend has been moved from src/app/examples/product-roadmap/product_roadmap-agent/ to examples-backend/product-roadmap-backend/ with a complete rewrite using Mastra v0.16.0. The new backend includes a proper Mastra instance configuration, workflow-based chat handling, and LibSQL storage for persistence.
Updated Dependencies: All Mastra packages have been upgraded significantly (e.g., @mastra/core from 0.11.1 to 0.16.0, @ai-sdk/openai from 1.3.10 to 2.0.23). The @cedar-os/backend dependency has been removed entirely, indicating a shift to rely solely on Mastra's capabilities.
Enhanced State Management: The product roadmap functionality has been refactored to support bulk operations. The node manipulation functions (addNode, removeNode, changeNode) now work with arrays instead of single objects, enabling more efficient batch processing by AI agents.
Streaming Architecture: New Server-Sent Events (SSE) utilities have been implemented using Mastra's streamVNext API for real-time communication between the AI agent and frontend. The chat workflow now supports proper streaming with text deltas and tool events.
API Restructuring: A comprehensive API registry has been created with endpoints for chat interactions, streaming, and thread management. The implementation includes proper OpenAPI schema definitions and Zod validation.
Tool Integration: New Mastra tools have been created using Cedar OS's createMastraToolForStateSetter helper to enable backend agents to trigger frontend state updates through standardized streaming mechanisms.
The refactoring removes voice functionality, consolidates duplicate implementations, and establishes a cleaner separation between frontend examples and backend services. The simple-chat-mastra example has been largely dismantled as part of focusing on the more comprehensive product roadmap implementation.
Confidence score: 3/5
- This PR contains significant architectural changes that could introduce runtime issues due to major dependency upgrades and code restructuring
- Score reflects the extensive scope of changes including breaking type modifications, complete file deletions, and major version upgrades that require careful testing
- Pay close attention to the streaming utilities implementation, dependency compatibility, and the product roadmap state management refactoring
33 files reviewed, 12 comments
No description provided.