-
Notifications
You must be signed in to change notification settings - Fork 1
refactor(agents)!: update provider configurations and navigation stru… #12
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
…cture - Update all agent provider options with proper TypeScript typing using satisfies operator - Remove deprecated structuredOutput flags from agent configurations - Replace demo/test routes with new networks navigation - Add MDX frontmatter handling and improve Turbopack compatibility - Move blog data to separate module for better organization - Update footer to use dynamic year with useEffect hook - Add new networks images and blog layout components BREAKING CHANGE: Agent provider configurations have been updated and may require dependency version updates. Navigation routes changed from /test to /networks.
|
Keep this PR in a mergeable state → Learn moreAll Green is an AI agent that automatically: ✅ Addresses code review comments ✅ Fixes failing CI checks ✅ Resolves merge conflicts |
Reviewer's GuideRefactors agent provider configurations to use typed GoogleGenerativeAIProviderOptions and removes deprecated options, updates site navigation from demo/test to networks, improves MDX/frontmatter handling and docs/blog layouts, and adds new documentation and assets for networks and internal components. Sequence diagram for navigation to networks pagessequenceDiagram
actor User
participant Navbar
participant NextRouter
participant NetworksPage
participant NetworksList
participant NetworkDetailPage
User->>Navbar: Click Networks button
Navbar->>NextRouter: navigate(/networks)
NextRouter->>NetworksPage: Render networks index
NetworksPage->>NetworksList: Render list of networks
User->>NetworksList: Click specific network card
NetworksList->>NextRouter: navigate(/networks/{id})
NextRouter->>NetworkDetailPage: Render network detail view
Class diagram for Agent providerOptions with GoogleGenerativeAIProviderOptions typingclassDiagram
class Agent {
+string id
+string name
+AgentConfig config
}
class AgentConfig {
+function generate(runtimeContext, providerMetadata)
+object tools
+object memory
+object options
}
class ProviderOptionsWrapper {
+GoogleProviderOptions google
}
class GoogleProviderOptions {
+ThinkingConfig thinkingConfig
+string[] responseModalities
+string mediaResolution
+string cachedContent
+object imageConfig
+number numberOfImages
}
class ThinkingConfig {
+string thinkingLevel
+boolean includeThoughts
+number thinkingBudget
}
class GoogleGenerativeAIProviderOptions {
<<type_from_ai_sdk_google>>
}
Agent --> AgentConfig
AgentConfig --> ProviderOptionsWrapper : uses
ProviderOptionsWrapper --> GoogleProviderOptions
GoogleProviderOptions --> ThinkingConfig
GoogleProviderOptions ..|> GoogleGenerativeAIProviderOptions : satisfies
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
🤖 Hi @ssdeanx, I've received your request, and I'm working on it now! You can track my progress in the logs for more details. |
Summary by CodeRabbitRelease Notes
✏️ Tip: You can customize this high-level summary in your review settings. WalkthroughThis PR introduces a blog section with layouts and shared post data, refactors navigation to point to Networks, standardizes Google AI provider type constraints across 20+ agents, adds comprehensive documentation files, implements MDX frontmatter stripping, extracts blog data to a reusable module, and updates build configuration for MDX plugin handling. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Areas requiring extra attention:
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary of ChangesHello @ssdeanx, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces significant refactorings to the application's agent configurations, enhancing type safety and streamlining provider options. It also overhauls the documentation and blog systems with new layouts, improved MDX handling, and comprehensive technical documentation for key application areas. Furthermore, core navigation has been updated to reflect a new 'Networks' section, improving overall application structure and user experience. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
🤖 I'm sorry @ssdeanx, but I was unable to process your request. Please see the logs for more details. |
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.
Hey there - I've reviewed your changes - here's some feedback:
- The new footer year logic using
useState/useEffectintroduces an initial empty year on SSR and adds unnecessary client-side work; consider computingnew Date().getFullYear()at render or module scope instead of managing it as React state. - Frontmatter stripping is now implemented both in the MDX
h2component and via theStripFrontmatterDOM helper, which is brittle and potentially fragile across layout changes; it would be more robust to centralize this behavior (e.g., via the existing remark frontmatter plugins in the MDX pipeline) rather than manipulating the DOM after render. - The
h2frontmatter guard inmdx-components.tsxonly triggers whenchildrenis a plain string, but MDX often passes headings as arrays or nested nodes; consider normalizingchildren(e.g., withReact.Children.toArray+textContentextraction) so frontmatter detection works reliably across MDX documents.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The new footer year logic using `useState`/`useEffect` introduces an initial empty year on SSR and adds unnecessary client-side work; consider computing `new Date().getFullYear()` at render or module scope instead of managing it as React state.
- Frontmatter stripping is now implemented both in the MDX `h2` component and via the `StripFrontmatter` DOM helper, which is brittle and potentially fragile across layout changes; it would be more robust to centralize this behavior (e.g., via the existing remark frontmatter plugins in the MDX pipeline) rather than manipulating the DOM after render.
- The `h2` frontmatter guard in `mdx-components.tsx` only triggers when `children` is a plain string, but MDX often passes headings as arrays or nested nodes; consider normalizing `children` (e.g., with `React.Children.toArray` + `textContent` extraction) so frontmatter detection works reliably across MDX documents.
## Individual Comments
### Comment 1
<location> `app/components/footer.tsx:62-70` </location>
<code_context>
setTimeout(() => setStatus("idle"), 3000)
}
+ const [year, setYear] = useState<number | null>(null)
+
+ useEffect(() => {
</code_context>
<issue_to_address>
**suggestion:** Using state and an effect for the year is unnecessary and briefly renders an empty value.
You can replace this `useState`/`useEffect` pair with a direct `new Date().getFullYear()` (or a hard-coded year), which is safe to run on the server and avoids extra client logic and the transient empty value on first render.
Suggested implementation:
```typescript
import Link from "next/link"
import { Button } from "@/ui/button"
import { Input } from "@/ui/input"
```
```typescript
setTimeout(() => setStatus("idle"), 3000)
}
const year = new Date().getFullYear()
```
</issue_to_address>
### Comment 2
<location> `tests/docs-hello-world.test.ts:1-2` </location>
<code_context>
+import { describe, it, expect } from 'vitest';
+const { sayHello } = require('../docs/hello-world.js');
+
+describe('Docs Hello World', () => {
</code_context>
<issue_to_address>
**suggestion:** Align test module style and typings with the rest of the codebase
Since this is a TypeScript test file and the repo favors ES modules, use an `import` with typing instead of `require`, e.g.
```ts
import { sayHello } from '../docs/hello-world';
```
This ensures proper type-checking and avoids potential CommonJS/ESM interop issues if `docs/hello-world` is updated later.
```suggestion
import { describe, it, expect } from 'vitest';
import { sayHello } from '../docs/hello-world';
```
</issue_to_address>
### Comment 3
<location> `docs/components/app-dashboard-documentation.md:39-49` </location>
<code_context>
+
+```mermaid
+graph TD
+ App[NextJS App] --> DashboardPage[app/dashboard/page.tsx]
+ DashboardPage --> DashboardProviders[DashboardProviders/providers.tsx]
+ DashboardProviders --> ReactQuery[React Query (QueryClient)]
</code_context>
<issue_to_address>
**nitpick (typo):** Align the "NextJS" label with the "Next.js" naming used elsewhere.
In the mermaid diagram this node is labeled `NextJS App`, but elsewhere you use `Next.js` (e.g., "Next.js 16"). Please update the node label to `Next.js App` for consistency.
```suggestion
```mermaid
graph TD
App[Next.js App] --> DashboardPage[app/dashboard/page.tsx]
DashboardPage --> DashboardProviders[DashboardProviders/providers.tsx]
DashboardProviders --> ReactQuery[React Query (QueryClient)]
DashboardPage --> Header[StatGrid / Cards]
DashboardPage --> Content[Cards: Agents, Workflows, Traces]
Content --> Subcomponents[_components/*: StatCard, DataTable, Sidebar, DetailPanel]
DataFetch --> Hooks[lib/hooks/use-dashboard-queries]
Hooks --> MastraAPI[Mastra Backend]
```
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| const [year, setYear] = useState<number | null>(null) | ||
|
|
||
| useEffect(() => { | ||
| setYear(new Date().getFullYear()) | ||
| }, []) | ||
|
|
||
| return ( | ||
| <footer className="border-t border-border bg-background"> | ||
| {/* Newsletter section */} |
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.
suggestion: Using state and an effect for the year is unnecessary and briefly renders an empty value.
You can replace this useState/useEffect pair with a direct new Date().getFullYear() (or a hard-coded year), which is safe to run on the server and avoids extra client logic and the transient empty value on first render.
Suggested implementation:
import Link from "next/link"
import { Button } from "@/ui/button"
import { Input } from "@/ui/input" setTimeout(() => setStatus("idle"), 3000)
}
const year = new Date().getFullYear()| import { describe, it, expect } from 'vitest'; | ||
| const { sayHello } = require('../docs/hello-world.js'); |
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.
suggestion: Align test module style and typings with the rest of the codebase
Since this is a TypeScript test file and the repo favors ES modules, use an import with typing instead of require, e.g.
import { sayHello } from '../docs/hello-world';This ensures proper type-checking and avoids potential CommonJS/ESM interop issues if docs/hello-world is updated later.
| import { describe, it, expect } from 'vitest'; | |
| const { sayHello } = require('../docs/hello-world.js'); | |
| import { describe, it, expect } from 'vitest'; | |
| import { sayHello } from '../docs/hello-world'; |
| date_created: 2025-12-06 | ||
| last_updated: 2025-12-06 | ||
| owner: AgentStack Frontend Team | ||
| tags: [component, ui, chat, provider, documentation] |
Check notice
Code scanning / Remark-lint (reported by Codacy)
Warn when references to undefined definitions are found. Note documentation
| date_created: 2025-12-06 | ||
| last_updated: 2025-12-06 | ||
| owner: AgentStack Frontend Team | ||
| tags: [component, ui, chat, provider, documentation] |
Check notice
Code scanning / Remark-lint (reported by Codacy)
Warn when shortcut reference links are used. Note documentation
| date_created: 2025-12-06 | ||
| last_updated: 2025-12-06 | ||
| owner: AgentStack Frontend Team | ||
| tags: [component, ui, dashboard, observability, admin] |
Check notice
Code scanning / Remark-lint (reported by Codacy)
Warn when references to undefined definitions are found. Note documentation
| date_created: 2025-12-06 | ||
| last_updated: 2025-12-06 | ||
| owner: AgentStack Frontend Team | ||
| tags: [component, ui, dashboard, observability, admin] |
Check notice
Code scanning / Remark-lint (reported by Codacy)
Warn when shortcut reference links are used. Note documentation
| date_created: 2025-12-06 | ||
| last_updated: 2025-12-06 | ||
| owner: AgentStack Frontend Team | ||
| tags: [component, ui, networks, provider, documentation] |
Check notice
Code scanning / Remark-lint (reported by Codacy)
Warn when references to undefined definitions are found. Note documentation
| date_created: 2025-12-06 | ||
| last_updated: 2025-12-06 | ||
| owner: AgentStack Frontend Team | ||
| tags: [component, ui, networks, provider, documentation] |
Check notice
Code scanning / Remark-lint (reported by Codacy)
Warn when shortcut reference links are used. Note documentation
| date_created: 2025-12-06 | ||
| last_updated: 2025-12-06 | ||
| owner: AgentStack Frontend Team | ||
| tags: [component, ui, workflows, visualization, provider] |
Check notice
Code scanning / Remark-lint (reported by Codacy)
Warn when references to undefined definitions are found. Note documentation
| date_created: 2025-12-06 | ||
| last_updated: 2025-12-06 | ||
| owner: AgentStack Frontend Team | ||
| tags: [component, ui, workflows, visualization, provider] |
Check notice
Code scanning / Remark-lint (reported by Codacy)
Warn when shortcut reference links are used. Note documentation
| date_created: 2025-12-06 | ||
| last_updated: 2025-12-06 | ||
| owner: AgentStack Frontend Team | ||
| tags: [library, client, sdk, hooks, types, docs] |
Check notice
Code scanning / Remark-lint (reported by Codacy)
Warn when references to undefined definitions are found. Note documentation
| date_created: 2025-12-06 | ||
| last_updated: 2025-12-06 | ||
| owner: AgentStack Frontend Team | ||
| tags: [library, client, sdk, hooks, types, docs] |
Check notice
Code scanning / Remark-lint (reported by Codacy)
Warn when shortcut reference links are used. Note documentation
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.
Code Review
This is a substantial and valuable pull request that significantly refactors agent configurations, improves the documentation structure, and enhances the MDX handling for better compatibility and developer experience. The move to TypeScript's satisfies operator for provider options is a great improvement for type safety, and the cleanup of deprecated flags and unused components is well-executed. The introduction of new layouts for the blog and docs sections, along with the centralized blog data, greatly improves code organization and maintainability. I've identified a critical issue with a component import in the new blog post page that will likely cause a build failure, along with a few medium-severity suggestions to improve code style and maintainability by addressing formatting and magic numbers. Overall, this is a very strong set of changes.
| export default function SessionSummary() { | ||
| const title = "Dev Session: Docs, MDX, Layouts & Fixes" | ||
| const date = "2025-12-06" | ||
| const readTime = "4 min read" | ||
| return ( | ||
| <BlogLayout title={title} date={date} readTime={readTime} category="Dev Diary"> | ||
| <section className="prose max-w-none mdx-content"> | ||
| <p> | ||
| This development session implemented a number of fixes and improvements across the repo — | ||
| focusing on the documentation system, MDX handling, page layouts, and developer ergonomics. | ||
| </p> | ||
|
|
||
| <h2>What I changed</h2> | ||
| <ul> | ||
| <li>Added docs layout with a persistent Navbar + left Sidebar for documentation pages.</li> | ||
| <li>Created a blog layout that also keeps the Navbar and adds a Recent posts sidebar.</li> | ||
| <li>Fixed several MDX loader/frontmatter issues and installed the missing MDX loader. | ||
| Added a defensive client-side strip of raw frontmatter while we stabilize server-side parsing.</li> | ||
| <li>Added OO-style documentation files under <code>docs/components/</code> for app/chat, app/networks, app/workflows, app/dashboard, and lib/.</li> | ||
| <li>Extracted blog post data into a shared file and added this session summary post.</li> | ||
| </ul> | ||
|
|
||
| <h2>Why this matters</h2> | ||
| <p> | ||
| These changes improve the developer experience when writing docs and blog posts, prevent | ||
| hydration mismatches caused by stray MDX frontmatter, and standardize layouts across docs | ||
| and blog sections so navigation is consistent. | ||
| </p> | ||
|
|
||
| <h2>Next steps</h2> | ||
| <ol> | ||
| <li>Replace the frontmatter runtime guard with a robust server-side parsing pipeline so | ||
| metadata becomes first-class page metadata rather than visible content.</li> | ||
| <li>Convert selected MDX docs to use true frontmatter exports and canonical metadata.</li> | ||
| <li>Add automated tests for MDX rendering and layout presence to prevent regressions.</li> | ||
| </ol> | ||
|
|
||
| <p>— Dev session complete</p> | ||
| </section> | ||
| </BlogLayout> | ||
| ) | ||
| } |
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.
There seems to be a confusion with the BlogLayout component being used here. This page imports a named export BlogLayout from app/components/blog-layout and passes props like title and date.
However, this pull request also introduces a new Next.js route layout at app/blog/layout.tsx, which is a default export and only accepts children. This session-summary page will be wrapped by that route layout.
This will likely cause a build error or a runtime error due to one of the following reasons:
- The component at
app/components/blog-layout.tsxis missing from this pull request. - The import path is incorrect.
- There's a naming collision and this page is intended to be simpler, without the wrapping
BlogLayoutcomponent.
Please verify the implementation. If app/components/blog-layout.tsx is a new component, it should be included in this PR. If it's an existing component, ensure it's being used correctly in the context of the new app/blog/layout.tsx route layout.
| <div className="sticky top-20 rounded-lg border border-border bg-card p-4"> | ||
| <div className="mb-3 text-sm font-semibold text-muted-foreground">Recent posts</div> | ||
| <ul className="space-y-3"> | ||
| {BLOG_POSTS.slice(0, 5).map((p) => ( |
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.
The number 5 is used here as a magic number to limit the number of recent posts. It's better to define this as a named constant at the top of the file for better readability and maintainability.
For example:
const RECENT_POSTS_COUNT = 5;
// ... later in the component
{BLOG_POSTS.slice(0, RECENT_POSTS_COUNT).map((p) => (| if (!main) return | ||
|
|
||
| // look at the first few block children | ||
| const candidates = Array.from(main.children).slice(0, 3) |
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.
The number 3 is used here as a magic number to determine how many child elements to check for frontmatter. This should be extracted into a named constant to improve clarity and make it easier to adjust in the future.
For example:
const CANDIDATE_ELEMENTS_TO_INSPECT = 3;
// ... in useEffect
const candidates = Array.from(main.children).slice(0, CANDIDATE_ELEMENTS_TO_INSPECT);| <Button variant="outline" size="lg" asChild> | ||
| <Link href="/contact">Request a Tool</Link> | ||
| </Button> |
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.
The indentation of this <Button> component seems to be incorrect. It's indented one level too deep, which misaligns it with the preceding 'Build Custom Tool' button.
| <Button variant="outline" size="lg" asChild> | |
| <Link href="/contact">Request a Tool</Link> | |
| </Button> | |
| <Button variant="outline" size="lg" asChild> | |
| <Link href="/contact">Request a Tool</Link> | |
| </Button> |
Greptile OverviewGreptile SummaryThis PR modernizes agent provider configurations and improves the development experience with better MDX handling and navigation structure. Major Changes:
Issues Found:
Impact: Confidence Score: 4/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant Dev as Developer
participant Agent as Agent Configuration
participant Provider as Google AI Provider
participant UI as UI Components
participant MDX as MDX Processor
Note over Dev,MDX: Agent Provider Configuration Update
Dev->>Agent: Remove structuredOutput flag
Dev->>Agent: Add satisfies GoogleGenerativeAIProviderOptions
Agent->>Provider: Type-safe configuration
Provider-->>Agent: Validated options
Note over Dev,MDX: Navigation Structure Change
Dev->>UI: Update navbar routes
UI->>UI: Replace /test → /networks
UI-->>Dev: Updated navigation
Note over Dev,MDX: MDX Frontmatter Handling
Dev->>MDX: Change plugin imports to strings
MDX->>MDX: Enable Turbopack serialization
Dev->>UI: Add StripFrontmatter component
Dev->>UI: Add h2 filtering in mdx-components
MDX-->>UI: Prevent frontmatter rendering
Note over Dev,UI: Blog Organization
Dev->>UI: Extract blog data to separate module
Dev->>UI: Create blog layout with sidebar
UI-->>Dev: Improved maintainability
|
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.
47 files reviewed, 5 comments
| import { google, GoogleGenerativeAIProviderOptions } from '@ai-sdk/google'; | ||
|
|
||
|
|
||
| const model = google('gemini-2.5-flash'); |
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.
syntax: Unused variable model declared but never used
| const model = google('gemini-2.5-flash'); |
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/mastra/agents/codingAgents.ts
Line: 9:9
Comment:
**syntax:** Unused variable `model` declared but never used
```suggestion
```
How can I resolve this? If you propose a fix, please make it concise.| searchCode, | ||
| getFileContent, | ||
| ...githubMCP.getTools(), | ||
| // ...githubMCP.getTools(), |
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.
style: Commented-out code should be removed
| // ...githubMCP.getTools(), | |
| }, |
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/mastra/agents/codingAgents.ts
Line: 120:120
Comment:
**style:** Commented-out code should be removed
```suggestion
},
```
How can I resolve this? If you propose a fix, please make it concise.| ], | ||
| }) | ||
|
|
||
| //log.info('Cached tokens:', providerMetadata.google?.usageMetadata); |
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.
style: Commented-out debug code should be removed
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/mastra/agents/codingAgents.ts
Line: 142:142
Comment:
**style:** Commented-out debug code should be removed
How can I resolve this? If you propose a fix, please make it concise.| outputProcessors: [ | ||
| new BatchPartsProcessor({ batchSize: 5, maxWaitTime: 100, emitOnNonText: true }), | ||
| ], |
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.
style: Empty outputProcessors array can be removed entirely for cleaner code
| outputProcessors: [ | |
| new BatchPartsProcessor({ batchSize: 5, maxWaitTime: 100, emitOnNonText: true }), | |
| ], | |
| }) |
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/mastra/agents/codingAgents.ts
Line: 138:139
Comment:
**style:** Empty `outputProcessors` array can be removed entirely for cleaner code
```suggestion
})
```
How can I resolve this? If you propose a fix, please make it concise.| outputProcessors: [ | ||
| new BatchPartsProcessor({ | ||
| batchSize: 5, | ||
| maxWaitTime: 100, | ||
| emitOnNonText: true, | ||
| }), | ||
| ], |
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.
style: Empty outputProcessors array can be removed
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/mastra/agents/researchAgent.ts
Line: 253:254
Comment:
**style:** Empty `outputProcessors` array can be removed
How can I resolve this? If you propose a fix, please make it concise.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.
Pull request overview
This PR refactors agent provider configurations across the codebase, adding explicit TypeScript typing using the satisfies operator. It also updates navigation from demo/test routes to networks, improves MDX frontmatter handling for Turbopack compatibility, and reorganizes blog data into a separate module.
Key Changes
- Added
satisfies GoogleGenerativeAIProviderOptionsto all agent provider configurations for improved type safety - Removed deprecated
structuredOutputflags and cleaned up unnecessary provider options - Replaced
/testroutes with/networksnavigation throughout the UI - Added MDX loader packages and improved frontmatter handling to prevent hydration mismatches
Reviewed changes
Copilot reviewed 47 out of 51 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/mastra/agents/*.ts | Updated all agent files with typed provider options and removed deprecated flags |
| app/components/navbar.tsx | Changed Demo link to Networks |
| app/components/footer.tsx | Added useEffect hook for dynamic year to prevent hydration mismatches |
| next.config.ts | Updated MDX plugins to use string specifiers for Turbopack compatibility |
| mdx-components.tsx | Added frontmatter filtering logic to prevent duplicate metadata rendering |
| app/docs/layout.tsx | New docs layout with persistent navbar and sidebar |
| app/blog/layout.tsx | New blog layout with sidebar showing recent posts |
| app/components/blog-data.tsx | Extracted blog posts data into shared module |
| docs/components/*.md | Added comprehensive technical documentation for major app sections |
| package.json | Added MDX loader and frontmatter handling dependencies |
| tests/docs-hello-world.test.ts | New test file for docs hello world example |
Comments suppressed due to low confidence (6)
src/mastra/agents/scriptWriterAgent.ts:1
- The import of
webScraperToolis added but there's no test coverage for this tool integration in the scriptWriterAgent. Consider adding tests to verify the tool is properly configured and can be invoked by the agent.
src/mastra/agents/researchAgent.ts:1 - The agent now supports IMAGE response modality, but there's no test coverage verifying that image responses are properly handled. Add tests to ensure image responses from the provider are correctly processed.
src/mastra/agents/editorAgent.ts:1 - Removing all tools from editorAgent (previously had code_execution and google_search) is a significant change that should be covered by tests to verify the agent still functions correctly without these tools.
src/mastra/agents/codingAgents.ts:1 - Commented-out code should be removed rather than left in the codebase. If this code needs to be temporarily disabled, use a feature flag or configuration option instead.
src/mastra/agents/codingAgents.ts:1 - Commented-out debug logging should be removed. If this logging is needed for debugging, implement it properly with a debug flag or remove it entirely.
src/mastra/agents/codingAgents.ts:1 - The
modelvariable is defined but never used in this file, and there's excessive whitespace between imports. Remove the unused variable and clean up the import spacing.
| : []; | ||
|
|
||
| return await Promise.all([ | ||
| return Promise.all([ |
Copilot
AI
Dec 6, 2025
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.
Removing the await keyword before Promise.all() is correct since the function is already async and the caller will await the result. However, ensure error handling in callers is updated if needed, as errors will now be thrown at the caller level rather than caught here.
| return Promise.all([ | |
| return await Promise.all([ |
| const [year, setYear] = useState<number | null>(null) | ||
|
|
||
| useEffect(() => { | ||
| setYear(new Date().getFullYear()) | ||
| }, []) | ||
|
|
Copilot
AI
Dec 6, 2025
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.
Initializing year as null and setting it in useEffect causes an initial render with an empty string which could create a layout shift. Consider initializing with new Date().getFullYear() directly or using a more elegant pattern like useState(() => new Date().getFullYear()) to avoid the initial null state.
| const [year, setYear] = useState<number | null>(null) | |
| useEffect(() => { | |
| setYear(new Date().getFullYear()) | |
| }, []) | |
| const [year] = useState(() => new Date().getFullYear()) |
| remarkPlugins: ["remark-gfm"], | ||
| rehypePlugins: ["rehype-highlight"], |
Copilot
AI
Dec 6, 2025
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.
Using string specifiers for plugins is a workaround for Turbopack serialization. Consider documenting this as a known limitation and adding a TODO to revert to function imports once Turbopack supports non-serializable options.
| h2: ({ children }) => { | ||
| // Skip rendering accidental MDX frontmatter that may appear verbatim | ||
| // in documents when frontmatter parsing is disabled. Frontmatter | ||
| // typically contains `title:` and `description:` keys; if we detect | ||
| // that pattern, render nothing to avoid duplicating metadata in the page | ||
| // body and to prevent SSR/CSR hydration mismatches. | ||
| if (typeof children === "string") { | ||
| const lower = children.toLowerCase() | ||
| if (lower.includes("title:") && lower.includes("description:")) return null | ||
| } | ||
|
|
||
| return ( | ||
| <h2 className="mb-4 mt-10 text-2xl font-bold text-foreground scroll-m-20"> | ||
| {children} | ||
| </h2> | ||
| ) | ||
| }, |
Copilot
AI
Dec 6, 2025
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.
This frontmatter detection logic is fragile and could hide legitimate h2 headings that happen to contain these words. Consider implementing proper server-side frontmatter parsing instead of this client-side workaround.
| h2: ({ children }) => { | |
| // Skip rendering accidental MDX frontmatter that may appear verbatim | |
| // in documents when frontmatter parsing is disabled. Frontmatter | |
| // typically contains `title:` and `description:` keys; if we detect | |
| // that pattern, render nothing to avoid duplicating metadata in the page | |
| // body and to prevent SSR/CSR hydration mismatches. | |
| if (typeof children === "string") { | |
| const lower = children.toLowerCase() | |
| if (lower.includes("title:") && lower.includes("description:")) return null | |
| } | |
| return ( | |
| <h2 className="mb-4 mt-10 text-2xl font-bold text-foreground scroll-m-20"> | |
| {children} | |
| </h2> | |
| ) | |
| }, | |
| h2: ({ children }) => ( | |
| <h2 className="mb-4 mt-10 text-2xl font-bold text-foreground scroll-m-20"> | |
| {children} | |
| </h2> | |
| ), |
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.
Actionable comments posted: 25
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (6)
src/mastra/agents/image_to_csv.ts (1)
123-133: Align responseModalities with CSV-only contractThe system prompt mandates returning only a CSV string, but
responseModalitiesallows['TEXT', 'IMAGE']. Depending on the Google model, this may encourage multimodal responses (e.g., image output) that violate the agent’s expected text-only contract. Consider restricting to TEXT unless you explicitly handle image responses downstream.- mediaResolution: 'MEDIA_RESOLUTION_MEDIUM', - responseModalities: ['TEXT', 'IMAGE'], + mediaResolution: 'MEDIA_RESOLUTION_MEDIUM', + responseModalities: ['TEXT'],src/mastra/agents/stockAnalysisAgent.ts (1)
7-12: Remove unused scorer imports.These scorer imports are no longer used after the removal of the scorers configuration block. Removing unused imports improves code maintainability and reduces bundle size.
Apply this diff to remove the unused imports:
-import { - financialDataScorer, - responseQualityScorer, - sourceDiversityScorer, - taskCompletionScorer, -} from '../scorers'src/mastra/agents/businessLegalAgents.ts (1)
55-123: Finish standardizing Google provider options and removingstructuredOutputflags
legalResearchAgenthas been updated to:
- Use
} satisfies GoogleGenerativeAIProviderOptionsonproviderOptions.google.- Drop deprecated fields like
structuredOutput.However, in the same file:
contractAnalysisAgent,complianceMonitoringAgent, andbusinessStrategyAgentstill setstructuredOutput: trueinsideproviderOptions.googleand don’t use thesatisfies GoogleGenerativeAIProviderOptionspattern.Given the PR objective to remove the deprecated
structuredOutputflag and standardize Google provider typing, it would be good to:
- Remove
structuredOutput(and any other deprecated fields) from these remaining agents’providerOptions.googleblocks.- Optionally apply the same
satisfies GoogleGenerativeAIProviderOptionsconstraint there for consistency and type safety.This keeps all business/legal agents aligned with the new provider configuration contract.
src/mastra/agents/dane.ts (1)
13-15: UnuseduserIdvariable.The
userIdis extracted fromruntimeContextbut never used in the instruction content. This pattern repeats across all agent definitions in this file (lines 14, 46, 75, 110, 146).Either remove the unused variable or interpolate it into the content:
instructions: ({ runtimeContext }) => { - const userId = runtimeContext.get('userId'); return { role: 'system', content: ` You are Dane, the ultimate GitHub operator.src/mastra/agents/recharts.ts (1)
3-3: Unused import:BatchPartsProcessor.The
BatchPartsProcessoris imported but not used anywhere in the file. Based on the AI summary,outputProcessorsconfigurations using this processor were removed. Clean up the import.-import { BatchPartsProcessor, UnicodeNormalizer } from '@mastra/core/processors' +import { UnicodeNormalizer } from '@mastra/core/processors'src/mastra/agents/sql.ts (1)
16-19: Unusedlanguagevariable.The
languageis extracted fromruntimeContextbut never used in the instruction content. Either remove it or use it for localized responses.instructions: ({ runtimeContext }: { runtimeContext: RuntimeContext<SqlAgentRuntimeContext> }) => { - // runtimeContext is read at invocation time const userTier = runtimeContext.get('user-tier') ?? 'free' - const language = runtimeContext.get('language') ?? 'en' return {
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (4)
docs/{0CA9633D-6C14-4807-930B-94B218D510C2}.pngis excluded by!**/*.pngnetworksCustomToolv1.pngis excluded by!**/*.pngnetworksv1.pngis excluded by!**/*.pngpackage-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (47)
README.md(1 hunks)app/api-reference/openapi-schema/page.mdx(1 hunks)app/blog/layout.tsx(1 hunks)app/blog/session-summary/page.tsx(1 hunks)app/components/blog-data.tsx(1 hunks)app/components/blog-list.tsx(1 hunks)app/components/footer.tsx(3 hunks)app/components/navbar.tsx(2 hunks)app/components/networks-list.tsx(1 hunks)app/components/sidebar.tsx(1 hunks)app/components/strip-frontmatter.tsx(1 hunks)app/components/tools-list.tsx(3 hunks)app/docs/getting-started/page.mdx(1 hunks)app/docs/layout.tsx(1 hunks)app/docs/page.tsx(0 hunks)docs/components/app-chat-documentation.md(1 hunks)docs/components/app-dashboard-documentation.md(1 hunks)docs/components/app-networks-documentation.md(1 hunks)docs/components/app-workflows-documentation.md(1 hunks)docs/components/lib-documentation.md(1 hunks)mdx-components.tsx(1 hunks)next.config.ts(1 hunks)package.json(1 hunks)src/components/ai-elements/code-block.tsx(1 hunks)src/mastra/agents/acpAgent.ts(1 hunks)src/mastra/agents/businessLegalAgents.ts(2 hunks)src/mastra/agents/calendarAgent.ts(2 hunks)src/mastra/agents/codingAgents.ts(7 hunks)src/mastra/agents/contentStrategistAgent.ts(2 hunks)src/mastra/agents/copywriterAgent.ts(2 hunks)src/mastra/agents/csv_to_excalidraw.ts(2 hunks)src/mastra/agents/dane.ts(6 hunks)src/mastra/agents/editorAgent.ts(3 hunks)src/mastra/agents/evaluationAgent.ts(2 hunks)src/mastra/agents/excalidraw_validator.ts(2 hunks)src/mastra/agents/image.ts(2 hunks)src/mastra/agents/image_to_csv.ts(2 hunks)src/mastra/agents/learningExtractionAgent.ts(2 hunks)src/mastra/agents/package-publisher.ts(2 hunks)src/mastra/agents/recharts.ts(5 hunks)src/mastra/agents/reportAgent.ts(2 hunks)src/mastra/agents/researchAgent.ts(2 hunks)src/mastra/agents/scriptWriterAgent.ts(3 hunks)src/mastra/agents/sql.ts(2 hunks)src/mastra/agents/stockAnalysisAgent.ts(3 hunks)src/mastra/agents/weather-agent.ts(2 hunks)tests/docs-hello-world.test.ts(1 hunks)
💤 Files with no reviewable changes (1)
- app/docs/page.tsx
🧰 Additional context used
📓 Path-based instructions (19)
**/app/**
📄 CodeRabbit inference engine (.github/instructions/next-js.instructions.md)
Use the
app/directory structure for route handlers, server components, and client components (Next.js 13+). Prefer this over thepages/directory for new projects.
Files:
app/components/sidebar.tsxapp/components/strip-frontmatter.tsxapp/components/blog-data.tsxapp/docs/getting-started/page.mdxapp/components/tools-list.tsxapp/blog/layout.tsxapp/docs/layout.tsxapp/components/navbar.tsxapp/components/blog-list.tsxapp/blog/session-summary/page.tsxapp/api-reference/openapi-schema/page.mdxapp/components/networks-list.tsxapp/components/footer.tsx
**/components/**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.github/instructions/next-js.instructions.md)
Use PascalCase for component file names (e.g.,
ComponentName.jsxorComponentName.tsx).
Files:
app/components/sidebar.tsxapp/components/strip-frontmatter.tsxapp/components/blog-data.tsxapp/components/tools-list.tsxapp/components/navbar.tsxapp/components/blog-list.tsxapp/components/networks-list.tsxapp/components/footer.tsxsrc/components/ai-elements/code-block.tsx
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.github/instructions/next-js.instructions.md)
**/*.{js,jsx,ts,tsx}: Usenext/dynamicfor dynamic imports to load components only when needed, improving initial load time.
Usenext/imagecomponent for automatic image optimization, including lazy loading and responsive images.
Use React.memo to prevent unnecessary re-renders of components.
Use the<Link prefetch>tag to prefetch pages that are likely to be visited.
Use getServerSideProps, getStaticProps, or server components for fetching data on the server-side.
Use SWR or React Query for client-side data fetching and caching.
Use CSS Modules, Styled Components, or Tailwind CSS for component-level styling. Prefer Tailwind CSS for rapid development.
Use React Context, Zustand, Jotai, or Recoil for managing global state. Avoid Redux unless necessary.
Usereact-hook-formfor managing forms and validation.
Only fetch the data that is needed by the component to avoid over-fetching.
Avoid long-running synchronous operations in the main thread to prevent blocking.
Always usesetStateor hooks to update state instead of mutating state directly.
Include a complete dependency array inuseEffecthooks to prevent unexpected behavior.
Avoid writing server-side code in client components to prevent exposing secrets or causing unexpected behavior.
Usetry...catchblocks for handling errors in asynchronous operations.
Implement error boundary components usinggetDerivedStateFromErrororcomponentDidCatchlifecycle methods.
Sanitize user input to prevent Cross-Site Scripting (XSS) attacks. Be especially careful when rendering HTML directly from user input.
Store authentication tokens in HTTP-only cookies or local storage securely.
Implement role-based access control to restrict access to sensitive resources.
Clean up event listeners and timers inuseEffecthooks to avoid memory leaks.
Only update state when necessary to reduce the number of re-renders and improve performance.
Use immutable data structures and avoid mutating data directly to prevent unexpected...
Files:
app/components/sidebar.tsxsrc/mastra/agents/calendarAgent.tsapp/components/strip-frontmatter.tsxsrc/mastra/agents/weather-agent.tsapp/components/blog-data.tsxsrc/mastra/agents/evaluationAgent.tsapp/components/tools-list.tsxsrc/mastra/agents/image_to_csv.tsapp/blog/layout.tsxsrc/mastra/agents/researchAgent.tsapp/docs/layout.tsxapp/components/navbar.tsxsrc/mastra/agents/contentStrategistAgent.tsapp/components/blog-list.tsxsrc/mastra/agents/excalidraw_validator.tssrc/mastra/agents/copywriterAgent.tsapp/blog/session-summary/page.tsxnext.config.tssrc/mastra/agents/csv_to_excalidraw.tssrc/mastra/agents/stockAnalysisAgent.tssrc/mastra/agents/dane.tstests/docs-hello-world.test.tssrc/mastra/agents/image.tssrc/mastra/agents/businessLegalAgents.tsapp/components/networks-list.tsxapp/components/footer.tsxsrc/mastra/agents/learningExtractionAgent.tssrc/mastra/agents/scriptWriterAgent.tssrc/mastra/agents/package-publisher.tsmdx-components.tsxsrc/mastra/agents/reportAgent.tssrc/mastra/agents/editorAgent.tssrc/mastra/agents/sql.tssrc/mastra/agents/acpAgent.tssrc/mastra/agents/codingAgents.tssrc/mastra/agents/recharts.tssrc/components/ai-elements/code-block.tsx
app/**/*.{tsx,ts}
📄 CodeRabbit inference engine (app/AGENTS.md)
app/**/*.{tsx,ts}: Use Tailwind CSS 4 with oklch color variables for styling in Next.js App Router pages and layouts
Use React 19 latest features in component implementations within the app directory
Files:
app/components/sidebar.tsxapp/components/strip-frontmatter.tsxapp/components/blog-data.tsxapp/components/tools-list.tsxapp/blog/layout.tsxapp/docs/layout.tsxapp/components/navbar.tsxapp/components/blog-list.tsxapp/blog/session-summary/page.tsxapp/components/networks-list.tsxapp/components/footer.tsx
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Never commit API keys or secrets to the repository; use maskSensitiveMessageData() helper from src/mastra/config/pg-storage.ts when logging
Files:
app/components/sidebar.tsxsrc/mastra/agents/calendarAgent.tsapp/components/strip-frontmatter.tsxsrc/mastra/agents/weather-agent.tsapp/components/blog-data.tsxsrc/mastra/agents/evaluationAgent.tsapp/components/tools-list.tsxsrc/mastra/agents/image_to_csv.tsapp/blog/layout.tsxsrc/mastra/agents/researchAgent.tsapp/docs/layout.tsxapp/components/navbar.tsxsrc/mastra/agents/contentStrategistAgent.tsapp/components/blog-list.tsxsrc/mastra/agents/excalidraw_validator.tssrc/mastra/agents/copywriterAgent.tsapp/blog/session-summary/page.tsxnext.config.tssrc/mastra/agents/csv_to_excalidraw.tssrc/mastra/agents/stockAnalysisAgent.tssrc/mastra/agents/dane.tstests/docs-hello-world.test.tssrc/mastra/agents/image.tssrc/mastra/agents/businessLegalAgents.tsapp/components/networks-list.tsxapp/components/footer.tsxsrc/mastra/agents/learningExtractionAgent.tssrc/mastra/agents/scriptWriterAgent.tssrc/mastra/agents/package-publisher.tsmdx-components.tsxsrc/mastra/agents/reportAgent.tssrc/mastra/agents/editorAgent.tssrc/mastra/agents/sql.tssrc/mastra/agents/acpAgent.tssrc/mastra/agents/codingAgents.tssrc/mastra/agents/recharts.tssrc/components/ai-elements/code-block.tsx
app/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use Next.js 16 App Router with React 19 for frontend development in the app/ directory
Files:
app/components/sidebar.tsxapp/components/strip-frontmatter.tsxapp/components/blog-data.tsxapp/components/tools-list.tsxapp/blog/layout.tsxapp/docs/layout.tsxapp/components/navbar.tsxapp/components/blog-list.tsxapp/blog/session-summary/page.tsxapp/components/networks-list.tsxapp/components/footer.tsx
{app,ui,src/components}/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use Tailwind CSS 4 with oklch color variables for styling in UI components
Files:
app/components/sidebar.tsxapp/components/strip-frontmatter.tsxapp/components/blog-data.tsxapp/components/tools-list.tsxapp/blog/layout.tsxapp/docs/layout.tsxapp/components/navbar.tsxapp/components/blog-list.tsxapp/blog/session-summary/page.tsxapp/components/networks-list.tsxapp/components/footer.tsxsrc/components/ai-elements/code-block.tsx
{app,src/components}/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
{app,src/components}/**/*.{ts,tsx}: Use shadcn/ui base components (34 components) located in ui/ directory for common UI elements
Use AI Elements library (30 components) from src/components/ai-elements/ for chat, reasoning, and canvas UIs
Files:
app/components/sidebar.tsxapp/components/strip-frontmatter.tsxapp/components/blog-data.tsxapp/components/tools-list.tsxapp/blog/layout.tsxapp/docs/layout.tsxapp/components/navbar.tsxapp/components/blog-list.tsxapp/blog/session-summary/page.tsxapp/components/networks-list.tsxapp/components/footer.tsxsrc/components/ai-elements/code-block.tsx
**/*.{js,ts}
📄 CodeRabbit inference engine (.github/instructions/next-js.instructions.md)
Use parameterized queries or an ORM to prevent SQL injection attacks.
Files:
src/mastra/agents/calendarAgent.tssrc/mastra/agents/weather-agent.tssrc/mastra/agents/evaluationAgent.tssrc/mastra/agents/image_to_csv.tssrc/mastra/agents/researchAgent.tssrc/mastra/agents/contentStrategistAgent.tssrc/mastra/agents/excalidraw_validator.tssrc/mastra/agents/copywriterAgent.tsnext.config.tssrc/mastra/agents/csv_to_excalidraw.tssrc/mastra/agents/stockAnalysisAgent.tssrc/mastra/agents/dane.tstests/docs-hello-world.test.tssrc/mastra/agents/image.tssrc/mastra/agents/businessLegalAgents.tssrc/mastra/agents/learningExtractionAgent.tssrc/mastra/agents/scriptWriterAgent.tssrc/mastra/agents/package-publisher.tssrc/mastra/agents/reportAgent.tssrc/mastra/agents/editorAgent.tssrc/mastra/agents/sql.tssrc/mastra/agents/acpAgent.tssrc/mastra/agents/codingAgents.tssrc/mastra/agents/recharts.ts
src/mastra/agents/**/*.ts
📄 CodeRabbit inference engine (src/mastra/AGENTS.md)
Add new agent definitions under
src/mastra/agentsthat wire tools together into higher-level behaviors
Files:
src/mastra/agents/calendarAgent.tssrc/mastra/agents/weather-agent.tssrc/mastra/agents/evaluationAgent.tssrc/mastra/agents/image_to_csv.tssrc/mastra/agents/researchAgent.tssrc/mastra/agents/contentStrategistAgent.tssrc/mastra/agents/excalidraw_validator.tssrc/mastra/agents/copywriterAgent.tssrc/mastra/agents/csv_to_excalidraw.tssrc/mastra/agents/stockAnalysisAgent.tssrc/mastra/agents/dane.tssrc/mastra/agents/image.tssrc/mastra/agents/businessLegalAgents.tssrc/mastra/agents/learningExtractionAgent.tssrc/mastra/agents/scriptWriterAgent.tssrc/mastra/agents/package-publisher.tssrc/mastra/agents/reportAgent.tssrc/mastra/agents/editorAgent.tssrc/mastra/agents/sql.tssrc/mastra/agents/acpAgent.tssrc/mastra/agents/codingAgents.tssrc/mastra/agents/recharts.ts
src/mastra/agents/*.ts
📄 CodeRabbit inference engine (src/mastra/agents/AGENTS.md)
src/mastra/agents/*.ts: Agent file naming convention: Create agent files using kebab-case with.tsextension in/src/mastra/agents/directory (e.g.,your-agent-name.ts)
Each agent must follow the pattern: export agent asconst yourAgent = new Agent({ id: 'your-agent-id', name: 'Your Agent Name', description: '...' })
Files:
src/mastra/agents/calendarAgent.tssrc/mastra/agents/weather-agent.tssrc/mastra/agents/evaluationAgent.tssrc/mastra/agents/image_to_csv.tssrc/mastra/agents/researchAgent.tssrc/mastra/agents/contentStrategistAgent.tssrc/mastra/agents/excalidraw_validator.tssrc/mastra/agents/copywriterAgent.tssrc/mastra/agents/csv_to_excalidraw.tssrc/mastra/agents/stockAnalysisAgent.tssrc/mastra/agents/dane.tssrc/mastra/agents/image.tssrc/mastra/agents/businessLegalAgents.tssrc/mastra/agents/learningExtractionAgent.tssrc/mastra/agents/scriptWriterAgent.tssrc/mastra/agents/package-publisher.tssrc/mastra/agents/reportAgent.tssrc/mastra/agents/editorAgent.tssrc/mastra/agents/sql.tssrc/mastra/agents/acpAgent.tssrc/mastra/agents/codingAgents.tssrc/mastra/agents/recharts.ts
src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Run eslint with --max-warnings=0 on src/**/*.{ts,tsx} to enforce linting standards
Files:
src/mastra/agents/calendarAgent.tssrc/mastra/agents/weather-agent.tssrc/mastra/agents/evaluationAgent.tssrc/mastra/agents/image_to_csv.tssrc/mastra/agents/researchAgent.tssrc/mastra/agents/contentStrategistAgent.tssrc/mastra/agents/excalidraw_validator.tssrc/mastra/agents/copywriterAgent.tssrc/mastra/agents/csv_to_excalidraw.tssrc/mastra/agents/stockAnalysisAgent.tssrc/mastra/agents/dane.tssrc/mastra/agents/image.tssrc/mastra/agents/businessLegalAgents.tssrc/mastra/agents/learningExtractionAgent.tssrc/mastra/agents/scriptWriterAgent.tssrc/mastra/agents/package-publisher.tssrc/mastra/agents/reportAgent.tssrc/mastra/agents/editorAgent.tssrc/mastra/agents/sql.tssrc/mastra/agents/acpAgent.tssrc/mastra/agents/codingAgents.tssrc/mastra/agents/recharts.tssrc/components/ai-elements/code-block.tsx
**/*.md
📄 CodeRabbit inference engine (.github/instructions/markdown.instructions.md)
**/*.md: Use appropriate heading levels (H2, H3, etc.) to structure markdown content. Do not use H1 headings, as these will be generated from the title. Use##for H2 and###for H3 in a hierarchical manner. Recommend restructuring if content includes H4 or higher levels.
Use bullet points (with-) or numbered lists (with1.) for lists in markdown. Indent nested lists with two spaces and ensure proper indentation and spacing.
Use fenced code blocks (triple backticks) for code snippets in markdown. Specify the language after the opening backticks for syntax highlighting (e.g.,csharp).
Use proper markdown syntax for links:[link text](URL). Ensure that link text is descriptive and URLs are valid and accessible.
Use proper markdown syntax for images:. Include a brief description of the image in the alt text for accessibility.
Use markdown tables (with|delimiters) for tabular data. Ensure proper formatting, alignment, and inclusion of headers.
Limit line length to 80 characters in markdown for readability. Use soft line breaks for long paragraphs.
Use appropriate whitespace in markdown to separate sections and improve readability. Use blank lines between sections and avoid excessive whitespace.
Include YAML front matter at the beginning of markdown files with required metadata fields:post_title,author1,post_slug,microsoft_alias,featured_image,categories(from /categories.txt),tags,ai_note,summary, andpost_date.
Files:
docs/components/app-workflows-documentation.mdREADME.mddocs/components/app-dashboard-documentation.mddocs/components/lib-documentation.mddocs/components/app-chat-documentation.mddocs/components/app-networks-documentation.md
**/app/**/layout.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.github/instructions/next-js.instructions.md)
**/app/**/layout.{js,jsx,ts,tsx}: Define layouts for routes and their children usinglayout.tsxorlayout.jsxfiles within theapp/directory.
Usenext/fontto optimize font loading and prevent layout shift.
Files:
app/blog/layout.tsxapp/docs/layout.tsx
app/**/layout.tsx
📄 CodeRabbit inference engine (app/AGENTS.md)
Use React Server Components (RSC) architecture with Next.js 16 App Router for pages and layouts
Files:
app/blog/layout.tsxapp/docs/layout.tsx
**/app/**/page.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.github/instructions/next-js.instructions.md)
Represent route UIs using
page.tsxorpage.jsxfiles within theapp/directory structure.
Files:
app/blog/session-summary/page.tsx
**/next.config.{js,ts}
📄 CodeRabbit inference engine (.github/instructions/next-js.instructions.md)
**/next.config.{js,ts}: Integrate linting and formatting into the build process to ensure consistent code.
Analyze bundle size using tools likewebpack-bundle-analyzerto identify large dependencies.
Use tree shaking to remove unused code from bundles.
Files:
next.config.ts
**/*.test.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.github/instructions/next-js.instructions.md)
**/*.test.{js,jsx,ts,tsx}: Write unit tests for individual components to ensure they are working correctly.
Use React Testing Library for component testing to encourage testing from a user perspective.
Mock external dependencies to isolate components during testing.
Use Jest or Mocha as a testing framework for unit and integration tests.
Use Mock Service Worker (msw) to intercept and mock API calls during testing.
Co-locate test files with components using a consistent naming convention (e.g.,ComponentName.test.js).
Test edge cases and error conditions to ensure components are robust.
Files:
tests/docs-hello-world.test.ts
**/*.test.ts?(x)
📄 CodeRabbit inference engine (AGENTS.md)
Use Vitest for all unit testing in the Mastra project
Files:
tests/docs-hello-world.test.ts
🧬 Code graph analysis (6)
app/components/sidebar.tsx (1)
ui/link.tsx (1)
Link(22-49)
app/components/tools-list.tsx (1)
ui/link.tsx (1)
Link(22-49)
app/docs/layout.tsx (4)
app/components/navbar.tsx (1)
Navbar(95-379)app/components/sidebar.tsx (1)
Sidebar(16-43)app/components/strip-frontmatter.tsx (1)
StripFrontmatter(9-34)app/components/footer.tsx (1)
Footer(46-242)
app/components/navbar.tsx (1)
ui/link.tsx (1)
Link(22-49)
app/blog/session-summary/page.tsx (1)
app/blog/layout.tsx (1)
BlogLayout(7-42)
src/mastra/agents/codingAgents.ts (1)
src/mastra/config/google.ts (1)
🪛 LanguageTool
docs/components/app-workflows-documentation.md
[style] ~146-~146: As an alternative to the over-used intensifier ‘very’, consider replacing this phrase.
Context: ...ogress mapping. - High: Add support for very large workflows (virtualized canvas, paginate...
(EN_WEAK_ADJECTIVE)
docs/components/app-dashboard-documentation.md
[style] ~113-~113: As an alternative to the over-used intensifier ‘very’, consider replacing this phrase.
Context: ...ve tables should use virtualization for very large datasets. - Reliability: UI gracefully ...
(EN_WEAK_ADJECTIVE)
[style] ~132-~132: As an alternative to the over-used intensifier ‘very’, consider replacing this phrase.
Context: ... virtualization for DataTable to handle very large result sets and include role-based test...
(EN_WEAK_ADJECTIVE)
docs/components/app-networks-documentation.md
[grammar] ~19-~19: Use a hyphen to join words.
Context: ...ts through multi-agent networks (A2A/MCP style workflows). - Expose a well-typed ...
(QB_NEW_EN_HYPHEN)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Agent
- GitHub Check: Sourcery review
- GitHub Check: Codacy Security Scan
🔇 Additional comments (34)
src/components/ai-elements/code-block.tsx (1)
52-72: Directly returningPromise.allfromhighlightCodeis correctReturning
Promise.all([...])directly from thisasyncfunction keeps the same observable behavior as the previousreturn await Promise.all([...])in this context (no surroundingtry/catch), and the call site using.then(([light, dark]) => ...)continues to work as before. No further changes needed here.src/mastra/agents/package-publisher.ts (1)
175-181: Verify@ai-sdk/googlepackage supportsGoogleGenerativeAIProviderOptionswiththinkingConfig.The
satisfies GoogleGenerativeAIProviderOptionspattern correctly enforces type safety. However, confirm that the installed@ai-sdk/googleversion exports this type and supports thethinkingConfigstructure withthinkingBudget: -1. Since the PR notes potential dependency version updates, verify compatibility by checkingpackage.jsonfor the@ai-sdk/googleversion and referencing the current library documentation for theGoogleGenerativeAIProviderOptionsinterface definition.src/mastra/agents/stockAnalysisAgent.ts (1)
27-27: Good addition for type safety.The import of
GoogleGenerativeAIProviderOptionsenables the type constraint on line 223, ensuring the provider configuration is type-safe.src/mastra/agents/excalidraw_validator.ts (2)
101-103: This configuration is consistent with the project-wide standard and does not require changes.The
responseModalities: ['TEXT', 'IMAGE']configuration at lines 101-103 is a standard pattern used across virtually all agents in the codebase (calendarAgent, dane, image_to_csv, evaluationAgent, contentStrategistAgent, businessLegalAgents, researchAgent, reportAgent, and others). This appears to be an intentional architectural choice to provide the model with capability flexibility, not a copy-paste error specific to this agent. Removing 'IMAGE' from this agent alone would create inconsistency with the established codebase pattern.
4-4: The import and configuration options are correct.GoogleGenerativeAIProviderOptionsis properly exported from@ai-sdk/google(v2.0.44+), and bothresponseModalitiesandmediaResolutionare valid, documented options in the Gemini API. TheresponseModalities: ['TEXT', 'IMAGE']configuration is standard across multiple agents in the codebase as part of the Google AI provider standardization.src/mastra/agents/reportAgent.ts (1)
94-104: The satisfies operator usage and provider options are correct.All properties and their values conform to the latest @ai-sdk/google API documentation:
thinkingConfigwiththinkingLevel: 'medium',includeThoughts: true, andthinkingBudget: -1(dynamic thinking) are validmediaResolution: 'MEDIA_RESOLUTION_MEDIUM'provides balanced image detail and costresponseModalities: ['TEXT', 'IMAGE']enables both text and image responsesThe
satisfies GoogleGenerativeAIProviderOptionstype assertion correctly validates the configuration at compile time without widening the object type.src/mastra/agents/codingAgents.ts (2)
105-108: Excellent tier-based model selection pattern.The dynamic model selection based on user tier is well-implemented and properly typed. This pattern ensures enterprise users get the more capable model while keeping costs manageable for other tiers.
212-212: Excellent use of TypeScriptsatisfiesfor type safety.The consistent application of the
satisfies GoogleGenerativeAIProviderOptionsoperator across all agent configurations provides compile-time type checking while preserving the exact object structure. This prevents type errors without sacrificing type information.Also applies to: 325-325, 436-436
src/mastra/agents/scriptWriterAgent.ts (2)
1-1: LGTM! Type import improves type safety.The addition of
GoogleGenerativeAIProviderOptionsimport enables proper TypeScript type checking via thesatisfiesoperator, aligning with the PR's objective to add proper typing to agent configurations.
9-9: The import is correct and the webScraperTool is production-ready.The
webScraperToolprovides enhanced functionality beyond the replaced tools. It includes:
- HTML parsing with JSDOM and Cheerio fallback
- CSS selector-based element extraction with attribute support
- HTML-to-markdown conversion with sanitization
- Secure file persistence with path validation
- Comprehensive error handling, tracing, and progress reporting
- XSS and injection attack prevention
The tool is well-implemented and appropriate for the Script Writer agent's needs.
app/components/navbar.tsx (2)
339-341: LGTM: Mobile navigation updated to Networks.The mobile CTA correctly updates to match the desktop navigation changes, maintaining consistency across viewports.
235-235: LGTM: Desktop navigation updated to Networks.The navigation link correctly updates from Demo to Networks, aligning with the PR's route changes from
/testto/networks. The/networksroute exists and is properly configured.src/mastra/agents/weather-agent.ts (1)
10-10: No changes needed. TheGoogleGenerativeAIProviderOptionstype is correctly exported by@ai-sdk/google(v2.0.44+) and properly imported on line 10. The usage on line 46 with thesatisfiesconstraint is valid and improves type safety as intended.app/components/footer.tsx (1)
3-3: Dynamic year via client-side state looks correctThe
yearstate +useEffectpattern is hook-safe and avoids server/client date mismatches; theyear ?? ''fallback also prevents renderingnull. Only minor tradeoff is a briefly empty year before hydration, which is acceptable here.Also applies to: 62-67, 225-225
src/mastra/agents/image.ts (1)
6-6: Type‑constraining Google provider options is a good improvementUsing
satisfies GoogleGenerativeAIProviderOptionsonproviderOptions.googlegives you strong typing without changing runtime behavior, and theimageConfigblock is kept minimal and clear. Please just confirm thatimageConfigand its fields match the exact shape expected by your current@ai-sdk/googleversion.Also applies to: 53-53
app/components/blog-list.tsx (1)
9-9: Externalizing BLOG_POSTS data looks goodImporting
BLOG_POSTSfrom a sharedblog-datamodule simplifies this component and enables reuse in layouts/sidebars, as long as the data shape (slug, date, readTime, etc.) remains consistent with the current usage.app/components/tools-list.tsx (2)
405-407: String hrefs for dynamic tool docs routes are appropriateSwitching to
href={/docs/tools/${tool.id}}simplifies the Link configuration and matches Next’s recommended pattern for[id]routes, while keeping the generated URLs unchanged.Also applies to: 478-480
583-587: CTA links now use straightforward static pathsUsing plain string hrefs (
"/docs/tools/custom"and"/contact") for these CTAs is clear and avoids unnecessary pathname/query objects, with no behavioral change.Also applies to: 588-590
src/mastra/agents/learningExtractionAgent.ts (1)
7-7: Aligning google provider options with GoogleGenerativeAIProviderOptions is goodAdding
GoogleGenerativeAIProviderOptionsand using} satisfies GoogleGenerativeAIProviderOptionson the@ai-sdk/googleversion exposes this type and thatthinkingConfigis still a valid field on it.Also applies to: 55-62
app/components/networks-list.tsx (1)
86-88: String href for network detail routes is correctUsing
href={/networks/${network.id}}is the idiomatic Next form for[id]routes and keeps the behavior of the previous pathname/query object while simplifying the code.src/mastra/agents/researchAgent.ts (1)
165-174: Provider options typing change looks correctConstraining
providerOptions.googlewithsatisfies GoogleGenerativeAIProviderOptionstightens typing without altering the runtime shape; no issues spotted here.src/mastra/agents/csv_to_excalidraw.ts (1)
161-170: Consistent providerOptions typingUsing
} satisfies GoogleGenerativeAIProviderOptionsforproviderOptions.googlematches the pattern used in other agents and improves type safety without changing runtime behavior. Looks good.src/mastra/agents/recharts.ts (1)
28-28: Type constraints applied consistently.The
satisfies GoogleGenerativeAIProviderOptionsassertions provide compile-time type safety for the Google provider options across all four chart agents.Also applies to: 116-116, 213-213, 361-361, 488-488
src/mastra/agents/calendarAgent.ts (1)
5-5: LGTM!The type constraint is correctly applied, and unlike some other agents, this one properly uses the
userIdvariable in the instruction content.Also applies to: 42-42
app/docs/layout.tsx (1)
10-28: Layout structure looks good.The server component layout correctly composes Navbar, Sidebar, Footer, and StripFrontmatter. The responsive design with conditional sidebar visibility follows Next.js App Router patterns.
app/blog/layout.tsx (1)
12-14: Docs Sidebar in Blog layout may cause confusion.The
Sidebarcomponent renders documentation navigation sections (Getting Started, Core Concepts, etc.). In the blog layout, this might confuse users expecting blog-specific navigation. Verify this is intentional cross-navigation, or consider a blog-specific sidebar.src/mastra/agents/sql.ts (1)
7-7: Type constraint correctly applied.The
satisfies GoogleGenerativeAIProviderOptionsassertion provides type safety for the Google provider configuration.Also applies to: 83-83
app/components/sidebar.tsx (1)
16-42: Clean sidebar implementation.The component correctly uses
usePathnamefor active link detection and follows responsive design patterns. The dynamic icon rendering via<s.icon />is a nice pattern.src/mastra/agents/dane.ts (1)
7-7: Type-safe provider options look good.The
satisfiesoperator correctly constrains the provider options toGoogleGenerativeAIProviderOptionswithout changing runtime behavior. This improves compile-time type checking across all agent configurations. TheresponseModalities: ['TEXT', 'IMAGE']field is a valid option supported by the Google AI provider, as confirmed by its consistent usage across multiple agent files in the codebase.src/mastra/agents/acpAgent.ts (1)
21-21: Type‑safe Google provider options look good, just confirm against SDK versionUsing
satisfies GoogleGenerativeAIProviderOptionsonproviderOptions.googleis a solid way to keep the config aligned with the SDK without widening types; the current fields (thinkingConfig, responseModalities) look consistent with other agents in this repo. Please just ensure the project compiles cleanly with the current@ai-sdk/googleversion so any drift in option names is caught by TS.Also applies to: 120-127
app/blog/session-summary/page.tsx (1)
1-44: SessionSummary blog page is straightforward and consistent with the new layoutThe page cleanly wraps static content in
BlogLayoutwith sensible metadata props and uses Tailwind prose styling; no issues from a routing or React/Next.js perspective.src/mastra/agents/contentStrategistAgent.ts (1)
8-8: Consistent Google provider typing; confirm options against current SDKThe switch to
} satisfies GoogleGenerativeAIProviderOptionsforproviderOptions.googlematches the pattern used in other agents and helps catch misconfigured fields (e.g.,mediaResolution,responseModalities) at compile time. Please confirm the current@ai-sdk/googleversion still expects these option names to avoid subtle type/config mismatches.Also applies to: 79-89
src/mastra/agents/copywriterAgent.ts (1)
16-16: Type‑safe Google options plus lower media resolution—confirm intentUsing
satisfies GoogleGenerativeAIProviderOptionsonproviderOptions.googleis a good move for catching config drift at compile time. SettingmediaResolution: 'MEDIA_RESOLUTION_LOW'will reduce image quality/size versus a medium setting; that seems reasonable for a text‑first copywriter agent, but please confirm this downgrade is intentional for your UX and cost profile, and that it still matches the valid enum values in the current@ai-sdk/googleversion.Also applies to: 115-125
src/mastra/agents/editorAgent.ts (1)
1-1: Provider typing is appropriate; empty tools array is intentional for this editor designThe import of
GoogleGenerativeAIProviderOptionsand thesatisfies GoogleGenerativeAIProviderOptionsannotation forproviderOptions.googleare correct. Thetools: []is valid and intentional—this agent is designed as a pure content editor relying on LLM reasoning and quality scorers rather than external tool invocation, which is appropriate for its role.
| export default function BlogLayout({ children }: { children: React.ReactNode }) { | ||
| return ( |
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.
🧹 Nitpick | 🔵 Trivial
Missing metadata export.
Unlike the docs layout, this layout doesn't export metadata. Add metadata for better SEO.
+export const metadata = {
+ title: "Blog - AgentStack",
+ description: "Latest news, tutorials, and insights from the AgentStack team",
+}
+
export default function BlogLayout({ children }: { children: React.ReactNode }) {📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| export default function BlogLayout({ children }: { children: React.ReactNode }) { | |
| return ( | |
| export const metadata = { | |
| title: "Blog - AgentStack", | |
| description: "Latest news, tutorials, and insights from the AgentStack team", | |
| } | |
| export default function BlogLayout({ children }: { children: React.ReactNode }) { | |
| return ( |
🤖 Prompt for AI Agents
In app/blog/layout.tsx around lines 7-8, the BlogLayout is missing an exported
metadata object for SEO; add an export const metadata placed above the default
export that includes at minimum title and description (and ideally
openGraph/title/description, canonical URL, and robots entries) matching the
blog context so Next.js can consume it for SEO; ensure the metadata shape
follows Next.js Metadata type (string fields or nested objects) and export it
alongside the default BlogLayout.
| {BLOG_POSTS.slice(0, 5).map((p) => ( | ||
| <li key={p.slug}> | ||
| <Link href={`/blog/${p.slug}`} className="block text-sm text-muted-foreground hover:text-foreground"> | ||
| <div className="flex items-center justify-between"> | ||
| <span className="font-medium text-foreground">{p.title}</span> | ||
| <span className="text-xs text-muted-foreground">{p.date}</span> | ||
| </div> | ||
| <p className="text-xs text-muted-foreground line-clamp-2">{p.excerpt}</p> | ||
| </Link> | ||
| </li> | ||
| ))} |
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.
🧹 Nitpick | 🔵 Trivial
Consider adding prefetch to blog post links.
Per coding guidelines, use <Link prefetch> for pages likely to be visited. Recent posts in the sidebar are high-probability navigation targets.
- <Link href={`/blog/${p.slug}`} className="block text-sm text-muted-foreground hover:text-foreground">
+ <Link href={`/blog/${p.slug}`} prefetch className="block text-sm text-muted-foreground hover:text-foreground">📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| {BLOG_POSTS.slice(0, 5).map((p) => ( | |
| <li key={p.slug}> | |
| <Link href={`/blog/${p.slug}`} className="block text-sm text-muted-foreground hover:text-foreground"> | |
| <div className="flex items-center justify-between"> | |
| <span className="font-medium text-foreground">{p.title}</span> | |
| <span className="text-xs text-muted-foreground">{p.date}</span> | |
| </div> | |
| <p className="text-xs text-muted-foreground line-clamp-2">{p.excerpt}</p> | |
| </Link> | |
| </li> | |
| ))} | |
| {BLOG_POSTS.slice(0, 5).map((p) => ( | |
| <li key={p.slug}> | |
| <Link href={`/blog/${p.slug}`} prefetch className="block text-sm text-muted-foreground hover:text-foreground"> | |
| <div className="flex items-center justify-between"> | |
| <span className="font-medium text-foreground">{p.title}</span> | |
| <span className="text-xs text-muted-foreground">{p.date}</span> | |
| </div> | |
| <p className="text-xs text-muted-foreground line-clamp-2">{p.excerpt}</p> | |
| </Link> | |
| </li> | |
| ))} |
🤖 Prompt for AI Agents
In app/blog/layout.tsx around lines 21 to 31, the Link elements for the recent
posts don't enable prefetching; update the Link JSX inside the BLOG_POSTS.map to
include the prefetch prop (e.g., <Link href={`/blog/${p.slug}`} prefetch> or
prefetch={true}) so Next will prefetch those high-probability navigation
targets; make the change for each mapped Link and keep existing props and
classes intact.
| export const BLOG_POSTS = [ | ||
| { | ||
| title: "Hello World with AgentStack (Mastra)", | ||
| excerpt: | ||
| "A 10-minute guide to get started with AgentStack, covering agents, tools, storage, MCP, and workflows.", | ||
| date: "2025-12-01", | ||
| readTime: "10 min read", | ||
| category: "Tutorial", | ||
| slug: "hello-world-agentstack", | ||
| }, | ||
| { | ||
| title: "Introducing AgentStack: Multi-Agent Framework for Production", | ||
| excerpt: | ||
| "Learn how AgentStack simplifies building, deploying, and managing AI agents at scale with our new open-source framework.", | ||
| date: "2025-11-28", | ||
| readTime: "5 min read", | ||
| category: "Announcement", | ||
| slug: "introducing-agentstack", | ||
| }, | ||
| { | ||
| title: "Building RAG Pipelines with PgVector", | ||
| excerpt: | ||
| "A comprehensive guide to implementing retrieval-augmented generation using PostgreSQL and vector embeddings.", | ||
| date: "2025-11-25", | ||
| readTime: "8 min read", | ||
| category: "Tutorial", | ||
| slug: "rag-pipelines-pgvector", | ||
| }, | ||
| { | ||
| title: "Agent Orchestration Patterns", | ||
| excerpt: "Explore common patterns for coordinating multiple AI agents in complex workflows.", | ||
| date: "2025-11-20", | ||
| readTime: "6 min read", | ||
| category: "Architecture", | ||
| slug: "agent-orchestration-patterns", | ||
| }, | ||
| { | ||
| title: "Observability for AI Applications", | ||
| excerpt: "How to implement tracing, monitoring, and debugging for your AI agent systems.", | ||
| date: "2025-11-15", | ||
| readTime: "7 min read", | ||
| category: "Best Practices", | ||
| slug: "observability-ai-applications", | ||
| }, | ||
| { | ||
| title: "Dev Session: Repo fixes, MDX, docs, and layouts", | ||
| excerpt: "Summary of recent development session: docs layouts, MDX fixes, blog & docs layouts, sidebar, and tooling updates.", | ||
| date: "2025-12-06", | ||
| readTime: "4 min read", | ||
| category: "Dev Diary", | ||
| slug: "session-summary", | ||
| }, | ||
| ] |
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.
🛠️ Refactor suggestion | 🟠 Major
Add TypeScript type definitions for blog post structure.
The exported BLOG_POSTS array lacks explicit TypeScript typing, which reduces type safety for consuming components.
Apply this diff to add proper typing:
+export interface BlogPost {
+ title: string;
+ excerpt: string;
+ date: string;
+ readTime: string;
+ category: string;
+ slug: string;
+}
+
-export const BLOG_POSTS = [
+export const BLOG_POSTS: readonly BlogPost[] = [
{
title: "Hello World with AgentStack (Mastra)",Alternatively, if using Zod for runtime validation:
import { z } from 'zod';
const BlogPostSchema = z.object({
title: z.string(),
excerpt: z.string(),
date: z.string().regex(/^\d{4}-\d{2}-\d{2}$/),
readTime: z.string(),
category: z.string(),
slug: z.string(),
});
export type BlogPost = z.infer<typeof BlogPostSchema>;
export const BLOG_POSTS = [...] as const satisfies readonly BlogPost[];🤖 Prompt for AI Agents
In app/components/blog-data.tsx lines 1-53, the BLOG_POSTS export is untyped
which reduces type safety; add an explicit BlogPost type (or a Zod
BlogPostSchema with date regex) and annotate/export the BLOG_POSTS array as
readonly BlogPost[] (or use "as const satisfies readonly BlogPost[]") so
consuming components get proper typing and optional runtime validation if using
Zod; update imports/exports accordingly and ensure each object conforms to the
type (date string format, required fields).
| <Link | ||
| key={s.href} | ||
| href={s.href} | ||
| className={`flex items-center gap-3 rounded-md px-3 py-2 text-sm transition-all hover:bg-primary/5 ${ | ||
| active ? "bg-primary/10 text-primary font-semibold" : "text-muted-foreground" | ||
| }`} | ||
| > | ||
| <s.icon className="size-4" /> | ||
| {s.title} | ||
| </Link> |
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.
🧹 Nitpick | 🔵 Trivial
Consider adding prefetch to navigation links.
Per coding guidelines, use <Link prefetch> for pages likely to be visited. Documentation sections are high-probability targets.
<Link
key={s.href}
href={s.href}
+ prefetch
className={`flex items-center gap-3 rounded-md px-3 py-2 text-sm transition-all hover:bg-primary/5 ${
active ? "bg-primary/10 text-primary font-semibold" : "text-muted-foreground"
}`}
>📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| <Link | |
| key={s.href} | |
| href={s.href} | |
| className={`flex items-center gap-3 rounded-md px-3 py-2 text-sm transition-all hover:bg-primary/5 ${ | |
| active ? "bg-primary/10 text-primary font-semibold" : "text-muted-foreground" | |
| }`} | |
| > | |
| <s.icon className="size-4" /> | |
| {s.title} | |
| </Link> | |
| <Link | |
| key={s.href} | |
| href={s.href} | |
| prefetch | |
| className={`flex items-center gap-3 rounded-md px-3 py-2 text-sm transition-all hover:bg-primary/5 ${ | |
| active ? "bg-primary/10 text-primary font-semibold" : "text-muted-foreground" | |
| }`} | |
| > | |
| <s.icon className="size-4" /> | |
| {s.title} | |
| </Link> |
🤖 Prompt for AI Agents
In app/components/sidebar.tsx around lines 27 to 36, the Link elements rendering
documentation/navigation entries should include the prefetch prop to improve
perceived navigation performance; update the Link JSX to add prefetch (e.g.
prefetch or prefetch={true}) for internal/documentation routes (ensure you only
add it for internal hrefs, not external links) and keep the existing
className/children unchanged.
| // look at the first few block children | ||
| const candidates = Array.from(main.children).slice(0, 3) | ||
| for (const el of candidates) { | ||
| const text = (el.textContent || "").trim().toLowerCase() | ||
| if (!text) continue | ||
| // common YAML frontmatter markers | ||
| if (text.startsWith("title:") || text.includes("title:") && text.includes("description:")) { | ||
| el.remove() | ||
| break | ||
| } | ||
| } | ||
| } catch (e) { | ||
| // intentionally no-op: if DOM shape is unexpected, don't break rendering | ||
| // eslint-disable-next-line no-console | ||
| console.debug("strip-frontmatter: no-op", e) | ||
| } | ||
| }, []) |
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.
🧹 Nitpick | 🔵 Trivial
Clarify frontmatter detection condition for readability and intent
The core heuristic:
if (text.startsWith("title:") || text.includes("title:") && text.includes("description:")) {relies on && binding tighter than ||, so it effectively means:
- remove if text starts with
title:, or - remove if it includes both
title:anddescription:.
Given the comments mention “starts with title: or contains description:”, it would be clearer to:
- Add parentheses to make the precedence explicit, and/or
- Align the condition with the intended rule (e.g., include
description:-only cases if that’s desired).
Example for clarity:
if (
text.startsWith("title:") ||
(text.includes("title:") && text.includes("description:"))
) {
el.remove()
break
}This is a minor readability/intent tweak; the current implementation is otherwise safe and bounded.
🤖 Prompt for AI Agents
In app/components/strip-frontmatter.tsx around lines 15 to 31, the conditional
combining startsWith and includes relies on operator precedence which makes the
intent unclear; update the if to make precedence explicit by grouping the
includes checks with parentheses (or rewrite to two clearly separated
conditions) so it reads: remove element if text.startsWith("title:") OR
(text.includes("title:") AND text.includes("description:")), and optionally add
a short inline comment clarifying the heuristic.
| import { log } from '../config/logger' | ||
| import { pgMemory } from '../config/pg-storage' | ||
| import { responseQualityScorer, structureScorer, taskCompletionScorer } from '../scorers' | ||
| import { GoogleGenerativeAIProviderOptions } from '@ai-sdk/google' |
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.
🧹 Nitpick | 🔵 Trivial
Google provider typing is solid; double‑check modality settings
Using satisfies GoogleGenerativeAIProviderOptions on providerOptions.google is a good move for type safety, and the new fields:
responseModalities: ['TEXT', 'IMAGE']mediaResolution: 'MEDIA_RESOLUTION_LOW'
are reasonable if you truly plan to allow image responses here. Given this agent’s contract is “always respond with valid JSON only”, you might instead keep responseModalities to ['TEXT'] to avoid any chance of image output affecting cost or behavior, unless you explicitly rely on images elsewhere.
Also, please confirm these option names/values align with the exact @ai-sdk/google version in use so the satisfies constraint stays valid.
Also applies to: 131-135
🤖 Prompt for AI Agents
In src/mastra/agents/evaluationAgent.ts around lines 7 and again around lines
131-135, the providerOptions.google currently allows image modality and low
media resolution; change responseModalities to only ['TEXT'] (and remove or
unset mediaResolution if images are not used) to ensure the agent always returns
JSON text only, then run TypeScript build to ensure the object still satisfies
GoogleGenerativeAIProviderOptions and adjust field names/values to exactly match
the installed @ai-sdk/google version if any type errors occur.
| import { InternalSpans } from "@mastra/core/ai-tracing"; | ||
| import { googleAI, pgMemory } from "../config"; | ||
| import { csvValidityScorer } from "../scorers"; | ||
| import { GoogleGenerativeAIProviderOptions } from "@ai-sdk/google"; |
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.
🧹 Nitpick | 🔵 Trivial
Prefer import type for type-only GoogleGenerativeAIProviderOptions
GoogleGenerativeAIProviderOptions is only used in a satisfies clause, so making this a type-only import avoids an unnecessary runtime dependency and matches common TS best practices.
-import { GoogleGenerativeAIProviderOptions } from "@ai-sdk/google";
+import type { GoogleGenerativeAIProviderOptions } from "@ai-sdk/google";📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| import { GoogleGenerativeAIProviderOptions } from "@ai-sdk/google"; | |
| import type { GoogleGenerativeAIProviderOptions } from "@ai-sdk/google"; |
🤖 Prompt for AI Agents
In src/mastra/agents/image_to_csv.ts around line 5, the
GoogleGenerativeAIProviderOptions is only used as a type in a satisfies clause
and should be a type-only import to avoid a runtime dependency; change the
import statement to use "import type { GoogleGenerativeAIProviderOptions } from
'@ai-sdk/google';" (and ensure your TS config allows type-only imports/emit),
leaving the rest of the code unchanged.
| import { pgMemory } from '../config/pg-storage.js'; | ||
| import { taskCompletionScorer } from '../scorers'; | ||
| import { activeDistTag, pnpmBuild, pnpmChangesetPublish, pnpmChangesetStatus } from '../tools/pnpm-tool'; | ||
| import { GoogleGenerativeAIProviderOptions } from '@ai-sdk/google'; |
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.
🧹 Nitpick | 🔵 Trivial
Consider using type-only import syntax.
The import is only used for type checking with the satisfies operator. Consider using the type keyword to clarify intent and potentially improve tree-shaking.
Apply this diff:
-import { GoogleGenerativeAIProviderOptions } from '@ai-sdk/google';
+import type { GoogleGenerativeAIProviderOptions } from '@ai-sdk/google';📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| import { GoogleGenerativeAIProviderOptions } from '@ai-sdk/google'; | |
| import type { GoogleGenerativeAIProviderOptions } from '@ai-sdk/google'; |
🤖 Prompt for AI Agents
In src/mastra/agents/package-publisher.ts around line 7, the import of
GoogleGenerativeAIProviderOptions is used only for type-checking with the
satisfies operator; change it to a type-only import by prefixing with the type
keyword (e.g., import type { GoogleGenerativeAIProviderOptions } from
'@ai-sdk/google';) so the import is clearly marked as type-only and can be
removed at runtime.
| tools: { | ||
| googleSearch: googleTools.googleSearch({ | ||
| mode: 'MODE_DYNAMIC', | ||
| dynamicThreshold: 0.7, | ||
| }), | ||
| codeExecution: googleTools.codeExecution({}), | ||
| urlContext: googleTools.urlContext({}), | ||
| webScraperTool | ||
| } |
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.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# First, read the scriptWriterAgent file to see the full context
echo "=== scriptWriterAgent.ts content ==="
cat -n src/mastra/agents/scriptWriterAgent.tsRepository: ssdeanx/AgentStack
Length of output: 4527
🏁 Script executed:
#!/bin/bash
# Search for usages of scriptWriterAgent
echo "=== Script Writer Agent References ==="
rg -n --type=ts 'scriptWriterAgent' -C2 | grep -v 'scriptWriterAgent.ts'
echo -e "\n=== Tests for scriptWriterAgent ==="
fd -e test.ts -e spec.ts -e test.js -e spec.js | xargs grep -l 'scriptWriterAgent' 2>/dev/null || echo "No test files found"Repository: ssdeanx/AgentStack
Length of output: 5765
🏁 Script executed:
#!/bin/bash
# Check for any imports of the removed tools in the codebase
echo "=== googleSearch references ==="
rg -n 'googleSearch' --type=ts -C2 | head -30
echo -e "\n=== codeExecution references ==="
rg -n 'codeExecution' --type=ts -C2 | head -30
echo -e "\n=== urlContext references ==="
rg -n 'urlContext' --type=ts -C2 | head -30Repository: ssdeanx/AgentStack
Length of output: 3310
🏁 Script executed:
#!/bin/bash
# Check agent file naming convention compliance
echo "=== Agent files in src/mastra/agents/ ==="
ls -la src/mastra/agents/
echo -e "\n=== Checking naming pattern ==="
fd --type=f '\.ts$' src/mastra/agents/ | head -20Repository: ssdeanx/AgentStack
Length of output: 3109
🏁 Script executed:
#!/bin/bash
# Check if webScraperTool exists and verify it
echo "=== Checking webScraperTool ==="
fd -name '*web-scraper*' -type f
echo -e "\n=== webScraperTool content ==="
cat -n src/mastra/tools/web-scraper-tool.ts | head -50Repository: ssdeanx/AgentStack
Length of output: 1982
🏁 Script executed:
#!/bin/bash
# Check git history to see if tools were actually removed from this agent
echo "=== Git log for scriptWriterAgent.ts ==="
git log --oneline src/mastra/agents/scriptWriterAgent.ts | head -10
echo -e "\n=== Previous version of scriptWriterAgent.ts ==="
git show HEAD~1:src/mastra/agents/scriptWriterAgent.ts 2>/dev/null | head -100 || echo "Could not retrieve previous version"Repository: ssdeanx/AgentStack
Length of output: 235
🏁 Script executed:
#!/antml/bin
# Verify if googleSearch, codeExecution, urlContext are tools that should be in an agent
echo "=== Agent tool imports across codebase ==="
rg -n 'tools:\s*\{' src/mastra/agents/ -A5 | head -60Repository: ssdeanx/AgentStack
Length of output: 3216
File naming violates agent naming convention.
The file scriptWriterAgent.ts should follow kebab-case naming per the coding guidelines. Rename to script-writer-agent.ts for consistency with the agent naming convention.
The webScraperTool configuration is appropriate and aligns with how other agents in the codebase configure their tools.
🤖 Prompt for AI Agents
In src/mastra/agents/scriptWriterAgent.ts around lines 94 to 96, the filename
violates the agent naming convention and must be renamed to kebab-case: change
the file to src/mastra/agents/script-writer-agent.ts; update all imports/exports
that reference the old filename across the repo (including tests, index/barrel
exports, and any build/tsconfig paths), adjust any related default/named export
lines if they include the filename, and run a project-wide search to ensure no
remaining references to scriptWriterAgent.ts remain before committing.
| import { describe, it, expect } from 'vitest'; | ||
| const { sayHello } = require('../docs/hello-world.js'); | ||
|
|
||
| describe('Docs Hello World', () => { | ||
| it('returns expected greeting', () => { | ||
| expect(sayHello()).toBe('Hello, AgentStack!'); | ||
| }); | ||
| }); |
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.
🧹 Nitpick | 🔵 Trivial
Consider using an ES module import for sayHello in this TS test
The test itself is fine and uses Vitest correctly, but since this is a .test.ts file already using import syntax, you may want to switch the require('../docs/hello-world.js') to an import for consistency and better type support:
-import { describe, it, expect } from 'vitest';
-const { sayHello } = require('../docs/hello-world.js');
+import { describe, it, expect } from 'vitest';
+import { sayHello } from '../docs/hello-world.js';📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| import { describe, it, expect } from 'vitest'; | |
| const { sayHello } = require('../docs/hello-world.js'); | |
| describe('Docs Hello World', () => { | |
| it('returns expected greeting', () => { | |
| expect(sayHello()).toBe('Hello, AgentStack!'); | |
| }); | |
| }); | |
| import { describe, it, expect } from 'vitest'; | |
| import { sayHello } from '../docs/hello-world.js'; | |
| describe('Docs Hello World', () => { | |
| it('returns expected greeting', () => { | |
| expect(sayHello()).toBe('Hello, AgentStack!'); | |
| }); | |
| }); |
🤖 Prompt for AI Agents
In tests/docs-hello-world.test.ts around lines 1–8, replace the CommonJS require
usage with an ES module import for consistency and better TypeScript support:
remove the const { sayHello } = require('../docs/hello-world.js') line and add
an ES import like import { sayHello } from '../docs/hello-world.js'; (ensure
your tsconfig/module settings allow ESM imports or change the path/extension if
needed).
#11 networks working smoothly
…cture
BREAKING CHANGE: Agent provider configurations have been updated and may require dependency version updates. Navigation routes changed from /test to /networks.
Summary by Sourcery
Refine agent provider configurations and documentation layouts while improving MDX handling and navigation.
New Features:
Bug Fixes:
Enhancements:
Build: