-
Notifications
You must be signed in to change notification settings - Fork 1
chore: refactor codebase for improved type safety and consistency #95
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
- Changed several type definitions from `type` to `interface` for better extensibility in components such as `PieSlice`, `ConfirmationContextValue`, and `QueueMessagePart`. - Updated function parameters and return types to use more consistent array syntax (e.g., `Array<Type>` instead of `Type[]`) in components like `DataTableProps` and `AttachmentsContext`. - Refactored various components to use `void` for fire-and-forget function calls, ensuring no promises are returned where void is expected, particularly in `ChatProvider` and `WorkflowActions`. - Removed unnecessary ESLint disable comments to clean up the code and improve readability. - Adjusted default parameter values to use shorthand syntax in hooks like `useDebounce` and `useToggle`. - Improved conditional return statements for clarity and consistency across multiple components. - Removed a test template file that was no longer needed. - Updated ESLint configuration to enhance type checking and ensure better adherence to coding standards.
Learn moreAll Green is an AI agent that automatically: ✅ Addresses code review comments ✅ Fixes failing CI checks ✅ Resolves merge conflicts |
Reviewer's GuideRefactors TypeScript types and React components for improved type-safety and consistency, and tightens ESLint configuration to leverage TypeScript’s recommended and type-checked rules while cleaning up obsolete comments and templates. Updated class diagram for chat and prompt context typesclassDiagram
direction LR
class AttachmentsContext {
<<interface>>
Array~FileUIPart_and_id~ files
add(files: Array~File~ | FileList) void
remove(id: string) void
clear() void
fileInputRef: RefObject~HTMLInputElement_or_null~
}
class TextInputContext {
<<interface>>
value: string
setInput(v: string) void
clear() void
}
class PromptInputControllerProps {
<<interface>>
textInput: TextInputContext
attachments: AttachmentsContext
__registerFileInput(inputRef: RefObject~HTMLInputElement_or_null~, open: function) void
}
class PromptInputMessage {
<<interface>>
text: string
files: Array~FileUIPart~
}
class QueuedTask {
<<interface>>
id: string
title: string
description: string
status: string
createdAt: Date
completedAt: Date
error: string
}
class WebPreviewData {
<<interface>>
id: string
url: string
title: string
code: string
language: string
html: string
editable: boolean
showConsole: boolean
height: number
}
class ChatContextValue {
<<interface>>
%% state
isLoading: boolean
isStreaming: boolean
chatError: Error
%% actions
sendMessage(text: string, files: Array~File~) void
stopGeneration() void
clearMessages() void
selectAgent(agentId: string) void
selectModel(modelId: string) void
dismissError() void
setFocusMode(enabled: boolean) void
addTask(task: Omit~QueuedTask,id~) string
updateTask(taskId: string, updates: Partial~QueuedTask~) void
removeTask(taskId: string) void
approveConfirmation(confirmationId: string) void
rejectConfirmation(confirmationId: string, reason: string) void
createCheckpoint(messageIndex: number, label: string) string
restoreCheckpoint(checkpointId: string) void
removeCheckpoint(checkpointId: string) void
setWebPreview(preview: WebPreviewData) void
setThreadId(threadId: string) void
setResourceId(resourceId: string) void
}
class AgentArtifactProps {
<<interface>>
artifact: ArtifactData
onClose() void
onCodeUpdate(artifactId: string, newCode: string) void
}
class AgentWebPreviewProps {
<<interface>>
preview: WebPreviewData
onClose() void
onCodeChange(code: string) void
defaultTab: string
height: string|number
}
class AgentCodeSandboxProps {
<<interface>>
code: string
title: string
dependencies: Record~string,string~
onClose() void
onCodeChange(code: string) void
editable: boolean
}
class AgentConfirmationProps {
<<interface>>
tool: ToolUIPart
state: string
severity: ConfirmationSeverity
className: string
onApprove(approvalId: string) void
onReject(approvalId: string) void
}
class AgentToolsProps {
<<interface>>
tools: Array~ChatToolInvocationState_or_DynamicToolUIPart~
className: string
}
class DataTableProps_T_ {
<<interface>>
columns: Array~Column_T_~
data: Array~T~
searchPlaceholder: string
searchKey: keyof_T_
}
ChatContextValue --> QueuedTask : uses
ChatContextValue --> WebPreviewData : manages
PromptInputControllerProps --> TextInputContext : aggregates
PromptInputControllerProps --> AttachmentsContext : aggregates
AgentArtifactProps --> WebPreviewData : related via UI
AgentWebPreviewProps --> WebPreviewData : renders
DataTableProps_T_ --> Column_T_ : contains
Updated class diagram for queue, confirmation, and shared UI contextsclassDiagram
direction LR
class QueueMessagePart {
<<interface>>
type: string
text: string
url: string
fileName: string
mediaType: string
}
class QueueMessage {
<<interface>>
id: string
parts: Array~QueueMessagePart~
}
class QueueTodo {
<<interface>>
id: string
title: string
description: string
}
class ToolUIPartApproval {
<<type>>
id: string
approved: boolean
reason: string
}
class ConfirmationContextValue {
<<interface>>
approval: ToolUIPartApproval
state: ToolUIPart_state_
}
class ConfirmationRequestProps {
<<interface>>
children: ReactNode
}
class ConfirmationAcceptedProps {
<<interface>>
children: ReactNode
}
class ConfirmationRejectedProps {
<<interface>>
children: ReactNode
}
class PieSlice {
<<interface>>
name: string
value: number
fill: string
}
class NavItem {
<<interface>>
title: string
href: Route
icon: ReactComponent
}
class AccordionContextValue {
<<interface>>
openItems: Array~string~
toggle(value: string) void
type: string
}
class RadioGroupContextValue {
<<interface>>
value: string
onChange(value: string) void
name: string
}
class SwitchProps {
<<interface>>
onCheckedChange(checked: boolean) void
}
class TabsProps {
<<interface>>
defaultValue: string
value: string
onValueChange(value: string) void
}
class ChainOfThoughtContextValue {
<<interface>>
isOpen: boolean
setIsOpen(open: boolean) void
}
class CodeBlockContextType {
<<interface>>
code: string
}
class ContextSchema {
<<interface>>
usedTokens: number
maxTokens: number
usage: LanguageModelUsage
}
class LoaderIconProps {
<<interface>>
size: number
}
class MessageBranchContextType {
<<interface>>
currentBranch: number
totalBranches: number
goToPrevious() void
goToNext() void
}
class PlanContextValue {
<<interface>>
isStreaming: boolean
}
class ReasoningContextValue {
<<interface>>
isStreaming: boolean
isOpen: boolean
setIsOpen(open: boolean) void
}
class TextShimmerProps {
<<interface>>
children: string
as: ElementType
className: string
}
class ToolHeaderProps {
<<interface>>
title: string
type: ToolUIPart_type_
state: ToolUIPart_state_
}
class WebPreviewContextValue {
<<interface>>
url: string
setUrl(url: string) void
consoleOpen: boolean
setConsoleOpen(open: boolean) void
}
QueueMessage --> QueueMessagePart : contains
ConfirmationContextValue --> ToolUIPartApproval : holds
AccordionContextValue --> SwitchProps : related via UI usage
RadioGroupContextValue --> TabsProps : coordinated inputs
ChainOfThoughtContextValue --> ReasoningContextValue : related concerns
PlanContextValue --> ReasoningContextValue : streaming state
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
|
Caution Review failedThe pull request is closed. Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings. WalkthroughConverted many type aliases to interfaces, split/imported type-only vs runtime imports, removed inline ESLint suppression comments, adjusted some async/fire-and-forget call sites, updated some public type shapes (added fields), and overhauled eslint.config.js. Changes
Sequence Diagram(s)(Skipped — changes are primarily type declarations, lint/config refactors, and localized component updates rather than a new multi-component control flow.) Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro 📒 Files selected for processing (10)
✏️ Tip: You can disable this entire section by setting 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 |
|
🤖 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 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 focuses on a comprehensive refactoring effort to enhance the codebase's type safety, consistency, and adherence to modern TypeScript and ESLint best practices. The changes primarily involve standardizing type definitions, refining asynchronous function handling, and cleaning up ESLint directives, all aimed at improving code maintainability and developer experience without altering core functionality. 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 - I've left some high level feedback:
- In
chat-messages.tsxwhen renderingAgentTool, you're now hardcodingtype={partType as unknown as 'data-tool-agent'}and castingnestedParttoMastraDataPart; this drops the actual runtimepartType(e.g.data-tool-workflow,data-tool-network) and may cause incorrect behavior or styling — consider passing through the realpartTypeand using a narrower union or a type guard instead of forcing it to'data-tool-agent'.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `chat-messages.tsx` when rendering `AgentTool`, you're now hardcoding `type={partType as unknown as 'data-tool-agent'}` and casting `nestedPart` to `MastraDataPart`; this drops the actual runtime `partType` (e.g. `data-tool-workflow`, `data-tool-network`) and may cause incorrect behavior or styling — consider passing through the real `partType` and using a narrower union or a type guard instead of forcing it to `'data-tool-agent'`.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
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 pull request significantly improves type safety and consistency throughout the codebase. The migration from type to interface, removal of unnecessary ESLint disable comments, and consistent use of void for fire-and-forget async calls are all valuable changes. The updated ESLint configuration is a great step towards enforcing higher code quality. I've identified a few areas for improvement, primarily a conflict between the new array type syntax (Array<T>) and the updated ESLint rule that enforces T[]. Addressing these points will ensure the codebase is fully consistent with its new linting standards.
|
|
||
| interface DataTableProps<T> { | ||
| columns: Column<T>[] | ||
| columns: Array<Column<T>> |
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.
While the PR description mentions a move to Array<Type>, the updated ESLint configuration in this same PR enforces the T[] syntax via the @typescript-eslint/array-type rule with { default: 'array-simple' }. This change introduces a linting error. To resolve this conflict and adhere to the new configuration, please use the T[] syntax.
| columns: Array<Column<T>> | |
| columns: Column<T>[] |
| export type AttachmentsContext = { | ||
| files: (FileUIPart & { id: string })[] | ||
| export interface AttachmentsContext { | ||
| files: Array<FileUIPart & { id: string }> |
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 change to Array<Type> syntax conflicts with the updated ESLint rule @typescript-eslint/array-type which is configured to enforce T[] (array-simple). This will cause a linting error. Please use the T[] syntax to align with the project's linting rules. This feedback applies to all similar array type changes in this file.
files: (FileUIPart & { id: string })[]
|
|
||
| it('handles empty array', async () => { | ||
| const data: Record<string, any>[] = [] | ||
| const data: Array<Record<string, any>> = [] |
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 use of Array<Record<string, any>> is inconsistent with the new ESLint rule @typescript-eslint/array-type which is set to enforce T[] (array-simple). This will cause a linting error. Please use the T[] syntax for consistency.
| const data: Array<Record<string, any>> = [] | |
| const data: Record<string, any>[] = [] |
| // eslint-disable-next-line object-shorthand | ||
| tracingContext: tracingContext, |
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 eslint-disable-next-line object-shorthand comment was added to allow writing tracingContext: tracingContext. However, the object-shorthand rule is enabled in the ESLint config to enforce using shorthand for properties where the key and variable name are the same. Disabling this rule here goes against the project's coding style. Please use the shorthand syntax.
| // eslint-disable-next-line object-shorthand | |
| tracingContext: tracingContext, | |
| tracingContext, |
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 the codebase to improve type safety and consistency by enforcing TypeScript and ESLint best practices. The changes align the code with the project's ESLint configuration, particularly the consistent-type-definitions, consistent-type-imports, array-type, curly, and object-shorthand rules.
Changes:
- Converted multiple
typealiases tointerfacedeclarations for better extensibility and consistency - Updated imports to use
typekeyword prefix for type-only imports - Standardized array type syntax using
Array<T>for complex types - Added braces to single-statement conditionals following the
curly: 'all'rule - Removed unnecessary ESLint disable comments throughout the codebase
- Enhanced type safety by using proper type assertions and
voidoperator for fire-and-forget promises - Removed unused imports and a test template file
Reviewed changes
Copilot reviewed 50 out of 53 changed files in this pull request and generated 19 comments.
Show a summary per file
| File | Description |
|---|---|
| eslint.config.js | Enhanced TypeScript type checking with recommended-type-checked config and added node globals |
| ui/*.tsx | Removed ESLint disable comments for callback parameters |
| hooks/*.ts | Changed default parameter syntax and added braces to early returns |
| src/components/ai-elements/*.tsx | Converted type aliases to interfaces, updated array syntax, and improved type imports |
| app/chat/providers/*.tsx | Added void operator for fire-and-forget promises, removed ESLint disables |
| app/chat/components/*.tsx | Improved type assertions and converted async callback pattern |
| app/dashboard/_components/*.tsx | Updated to type-only imports and changed array syntax |
| src/mastra/tools/*.ts | Fixed type imports and corrected shorthand syntax |
| src/mastra/config/*.ts | Removed unused google import |
| convex/_generated/*.js | Removed unnecessary ESLint disable comments |
| test-templates/ | Removed unused test template file |
Comments suppressed due to low confidence (1)
app/chat/components/chat-messages.tsx:203
- This change from async/await to promise chain reduces code readability compared to the original async/await pattern. While it avoids the async function callback issue, it makes error handling less clear. The original pattern with async/await was more modern and easier to understand.
const handleCopy = useCallback(() => {
navigator.clipboard
.writeText(text)
.then(() => {
setCopied(true)
setTimeout(() => setCopied(false), 2000)
})
.catch((err) => {
console.error('Failed to copy:', err)
})
}, [text])
| // eslint-disable-next-line object-shorthand | ||
| tracingContext: tracingContext, |
Copilot
AI
Jan 15, 2026
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 ESLint disable comment contradicts the purpose of this refactoring PR. The object-shorthand rule is set to 'error' in the ESLint config (line 85), which should enforce using tracingContext instead of tracingContext: tracingContext. Either remove the disable comment and use the shorthand syntax, or if the longhand is intentional for clarity, add a comment explaining why the shorthand is disabled.
|
|
||
| useEffect(() => { | ||
| if (delay === null) return | ||
| if (delay === null) {return} |
Copilot
AI
Jan 15, 2026
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 curly braces placement is inconsistent with proper formatting. According to the ESLint config's curly: ['error', 'all'] rule, the opening brace should be on the same line with proper spacing, but the return statement should be on its own line. This should be formatted as if (delay === null) {\n return\n} for readability and consistency.
|
|
||
| useEffect(() => { | ||
| if (delay === null) return | ||
| if (delay === null) {return} |
Copilot
AI
Jan 15, 2026
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.
Same formatting issue as Comment 2. The return statement should be on its own line: if (delay === null) {\n return\n}.
| // Let provider know about our hidden file input so external menus can call openFileDialog() | ||
| useEffect(() => { | ||
| if (!usingProvider) return | ||
| if (!usingProvider) {return} |
Copilot
AI
Jan 15, 2026
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.
Same formatting issue. The return statement should be on its own line for consistency with the ESLint curly: ['error', 'all'] rule.
| useEffect(() => { | ||
| const form = formRef.current | ||
| if (!form) return | ||
| if (!form) {return} |
Copilot
AI
Jan 15, 2026
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.
Same formatting issue. The return statement should be on its own line.
| import { createVectorQueryTool, createGraphRAGTool } from '@mastra/rag' | ||
| import { google } from '@ai-sdk/google' | ||
| import { embedMany } from 'ai' | ||
| import type { UIMessage } from 'ai' |
Copilot
AI
Jan 15, 2026
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.
'UIMessage' is defined but never used.
| retries?: number | ||
| // eslint-disable-next-line no-unused-vars | ||
|
|
||
| retryDelay?: (retryCount: number, error: any) => number |
Copilot
AI
Jan 15, 2026
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.
Unexpected any. Specify a different type.
|
|
||
| // Ensure at least one progress call included the expected in-progress message and metadata | ||
| const hasInProgressCall = mockWriter.custom.mock.calls.some( | ||
| (c: any) => { |
Copilot
AI
Jan 15, 2026
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.
Unexpected any. Specify a different type.
|
|
||
| it('handles empty array', async () => { | ||
| const data: Record<string, any>[] = [] | ||
| const data: Array<Record<string, any>> = [] |
Copilot
AI
Jan 15, 2026
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.
Unexpected any. Specify a different type.
| mockContext | ||
| ) | ||
|
|
||
| const successResult = result as any |
Copilot
AI
Jan 15, 2026
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.
Unexpected any. Specify a different type.
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: 14
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (13)
hooks/use-utils.ts (2)
71-76: Minor formatting inconsistency.The braces satisfy the
curly: ['error', 'all']rule, but the compressed formatting{return}is unusual. Consider adding spaces for readability:{ return }or expanding to multiple lines for consistency with the rest of the codebase.✨ Suggested formatting
- if (delay === null) {return} + if (delay === null) { return }Or multi-line:
- if (delay === null) {return} + if (delay === null) { + return + }
86-91: Same formatting note asuseInterval.The same compressed brace formatting
{return}appears here. Consider applying consistent formatting across both hooks.app/workflows/components/workflow-actions.tsx (2)
27-34: Implement the SVG export functionality or remove placeholder code.The TODO comment indicates incomplete functionality, and the console.log appears to be debug/placeholder code. Consider either:
- Implementing the actual SVG export using React Flow's export utilities
- Removing or hiding this button until the feature is implemented
Would you like me to generate an implementation for the SVG export functionality? React Flow provides
getNodes(),getEdges(), and viewport utilities that can be used to export the workflow as SVG.
36-46: Consider fallback handling for the VSCode protocol.The
vscode://fileprotocol only works when VSCode is installed and configured to handle the protocol. Consider adding:
- User feedback if the window.open fails or the protocol isn't supported
- A fallback option (e.g., display the file path to copy, or link to a web-based viewer)
- Detection or configuration to check if VSCode is available
💡 Example: Add basic error feedback
const handleViewCode = useCallback(() => { if (!workflowConfig) { return } - // Open workflow source code const workflowPath = `/src/mastra/workflows/${workflowConfig.id .replace(/([A-Z])/g, '-$1') .toLowerCase() .replace(/^-/, '')}.ts` - window.open(`vscode://file${workflowPath}`, '_blank') + const opened = window.open(`vscode://file${workflowPath}`, '_blank') + if (!opened) { + console.warn('Failed to open VSCode. Path:', workflowPath) + // Optionally show user-facing toast/notification + } }, [workflowConfig])app/dashboard/_components/data-table.tsx (1)
24-35: Inconsistent array type syntax within the same interface.Line 25 uses
Array<Column<T>>while line 26 still usesT[]. If the PR objective is to standardize onArray<Type>syntax, consider updatingdatatoArray<T>for consistency within this interface.Suggested fix for consistency
interface DataTableProps<T> { columns: Array<Column<T>> - data: T[] + data: Array<T> searchPlaceholder?: string searchKey?: keyof T onRowClick?: (row: T) => void selectedId?: string getRowId?: (row: T) => string pageSize?: number emptyMessage?: string className?: string }src/components/ai-elements/confirmation.tsx (1)
14-36: Redundant union branch inToolUIPartApproval.The union branch at lines 25-29 (
{ id: string; approved: true; reason?: string }) is redundant. It's fully covered by the branch at lines 20-24 ({ id: string; approved: boolean; reason?: string }), sincebooleanalready includestrue. The AI summary indicates this branch was intended to be removed.🔧 Suggested fix
type ToolUIPartApproval = | { id: string approved?: never reason?: never } | { id: string approved: boolean reason?: string } - | { - id: string - approved: true - reason?: string - } - | { id: string approved: false reason?: string } | undefinedsrc/mastra/tools/tests/csv-to-json.tool.test.ts (1)
95-141: Inconsistent indentation in test case.The
should emit progress eventstest case uses 8-space indentation instead of the 2-space indentation used consistently throughout the rest of this file and codebase. This should be fixed for consistency.🔧 Proposed fix
it('should emit progress events', async () => { - // Arrange - const csvData = 'name,value\nTest,100' - const mockWriter: any = { - custom: vi.fn(), - write: vi.fn(), - } - const mockSpan: any = { - update: vi.fn(), - end: vi.fn(), - error: vi.fn(), - } - const mockTracingContext: any = { - currentSpan: { - createChildSpan: vi.fn().mockReturnValue(mockSpan), - }, - } - - // Act - await csvToJsonTool.execute!( - { - csvData, - options: { - delimiter: ',', - columns: true, - trim: true, - skip_empty_lines: true, - }, - }, - { - writer: mockWriter, - tracingContext: mockTracingContext, - abortSignal: new AbortController().signal, - } - ) - - // Assert - expect(mockWriter.custom).toHaveBeenCalledWith( - expect.objectContaining({ - type: 'data-tool-progress', - data: expect.objectContaining({ - status: 'in-progress', - }), - id: 'csv-to-json', - }) - ) - }) + // Arrange + const csvData = 'name,value\nTest,100' + const mockWriter: any = { + custom: vi.fn(), + write: vi.fn(), + } + const mockSpan: any = { + update: vi.fn(), + end: vi.fn(), + error: vi.fn(), + } + const mockTracingContext: any = { + currentSpan: { + createChildSpan: vi.fn().mockReturnValue(mockSpan), + }, + } + + // Act + await csvToJsonTool.execute!( + { + csvData, + options: { + delimiter: ',', + columns: true, + trim: true, + skip_empty_lines: true, + }, + }, + { + writer: mockWriter, + tracingContext: mockTracingContext, + abortSignal: new AbortController().signal, + } + ) + + // Assert + expect(mockWriter.custom).toHaveBeenCalledWith( + expect.objectContaining({ + type: 'data-tool-progress', + data: expect.objectContaining({ + status: 'in-progress', + }), + id: 'csv-to-json', + }) + ) + })app/api/contact/route.ts (1)
41-49: PII logged to console violates data privacy guidelines.The contact form logs personally identifiable information (email, full name) directly to the console. Per coding guidelines, PII should never be logged. Consider masking or omitting sensitive fields, or use a structured logging service that can redact PII automatically.
🔒 Proposed fix
// Store in database or send email // Option 1: Log for now (replace with actual implementation) console.log('Contact form submission:', { - name: `${data.firstName} ${data.lastName}`, - email: data.email, - company: data.company || 'N/A', + hasName: Boolean(data.firstName && data.lastName), + hasEmail: Boolean(data.email), + hasCompany: Boolean(data.company), inquiryType: data.inquiryType || 'general', subject: data.subject, - message: data.message, + messageLength: data.message.length, timestamp: new Date().toISOString(), })Based on coding guidelines: "Never include passwords, API keys, tokens, or personally identifiable information (PII) in code or logs."
ui/accordion.tsx (1)
24-31: Consider removing the leftover blank line in AccordionProps.Same issue as above - the blank line at line 28 disrupts the interface definition readability.
✨ Suggested cleanup
export interface AccordionProps extends React.HTMLAttributes<HTMLDivElement> { type?: 'single' | 'multiple' defaultValue?: string | string[] value?: string | string[] - onValueChange?: (value: string | string[]) => void collapsible?: boolean }app/networks/providers/network-context.tsx (1)
67-85: Consider removing leftover blank lines in the interface definition.The ESLint disable comment removal is appropriate, but the remaining blank lines at lines 81 and 83 create inconsistent spacing within the
NetworkContextValueinterface. Other members don't have blank lines between them.✨ Suggested cleanup
export interface NetworkContextValue { selectedNetwork: NetworkId networkConfig: NetworkConfig | undefined networkStatus: NetworkStatus routingSteps: RoutingStep[] progressEvents: ProgressEvent[] messages: UIMessage[] streamingOutput: string streamingReasoning: string toolInvocations: ToolInvocationState[] sources: Source[] error: string | null stopExecution: () => void clearHistory: () => void - selectNetwork: (networkId: NetworkId) => void - sendMessage: (text: string) => void }app/chat/providers/chat-context.tsx (1)
573-686: Large context value is appropriately memoized.The extensive dependency array is necessary given the number of values and callbacks exposed by this context. The use of
useMemoprevents unnecessary re-renders of consumers. Consider in the future whether this context could be split into smaller, more focused contexts (e.g.,ChatActionsContext,ChatStateContext) to reduce coupling and improve performance for consumers that only need a subset of values.app/chat/providers/chat-context-types.ts (2)
64-70: Duplicate WebPreviewData interface with different fields.This
WebPreviewDatainterface is missing several optional fields present inapp/chat/components/chat.types.ts(lines 98-108):html,editable,showConsole, andheight. Consider consolidating these into a single source of truth to avoid type mismatches.
41-46: Critical type mismatch: QueuedTask definitions differ between files used inconsistently across the codebase.The
QueuedTaskinterface is defined in bothchat-context-types.ts(incomplete) andchat.types.ts(complete withcreatedAt,completedAt,errorfields). This causes a type safety violation:chat-context.tsxuses the incomplete definition when managingqueuedTasks, butagent-queue.tsximports the complete definition and accessestask.createdAtandtask.errorfields that don't exist in the declared type. The same issue exists withWebPreviewData.Consolidate both interface definitions to a single canonical location and update all imports to use that source. Ensure the unified type includes all fields required by consuming components.
🤖 Fix all issues with AI agents
In `@app/chat/components/agent-artifact.tsx`:
- Around line 62-73: The handleCopy handler currently swallows clipboard errors
(in doCopy's catch it does "void err"); update the catch to log the error like
the other component to aid debugging — inside the doCopy catch block for
navigator.clipboard.writeText(editedCode) replace the silent discard with a
console.error('Failed to copy:', err) (or the project's logger if preferred) and
keep the existing setCopied/setTimeout behavior unchanged; reference handleCopy
and the inner doCopy async function to locate the change.
In `@app/chat/components/agent-confirmation.tsx`:
- Around line 31-34: The interface that declares className, onApprove and
onReject has unnecessary blank lines; remove the extra empty lines so the
properties are contiguous (e.g., className followed immediately by onApprove and
onReject) to match typical TypeScript formatting and improve readability.
In `@app/chat/components/chat.types.ts`:
- Around line 1-111: Convert remaining bracket-style array types to generic
Array<T> for consistency: change TaskStep[] in AgentTaskData.steps to
Array<TaskStep>, change PlanStep[] | string[] in AgentPlanData.steps to
Array<PlanStep> | Array<string>, change AgentSuggestionsProps.suggestions from
string[] to Array<string>, and change InlineCitationRender from ReactNode[] to
Array<ReactNode>; update only the type annotations (no runtime logic).
In `@app/chat/providers/chat-context-types.ts`:
- Around line 105-145: The interface in chat-context-types.ts has extra blank
lines left by removed ESLint comments; clean up the spacing by removing
consecutive empty lines between method signatures (e.g., sendMessage,
stopGeneration, clearMessages, selectAgent, selectModel, dismissError,
setFocusMode, addTask, updateTask, removeTask, approveConfirmation,
rejectConfirmation, createCheckpoint, restoreCheckpoint, removeCheckpoint,
setWebPreview, setThreadId, setResourceId) so each method is separated
consistently (single blank line or none) to improve readability.
In `@app/components/api-components.tsx`:
- Around line 3-4: Fix the minor import formatting: ensure the type-only import
reads with proper spacing around the brace (ReactNode -> ReactNode }) and make
semicolon usage consistent between imports. Update the import lines so they use
the same semicolon convention and spacing—e.g., change the type import to
"import type { ReactNode } from 'react';" and match the useState import
punctuation/semicolons accordingly in app/components/api-components.tsx.
In `@app/dashboard/_components/data-table.tsx`:
- Around line 85-87: The comparator is using loose equality checks ("aVal ==
null" / "bVal == null"); replace these with explicit strict checks to satisfy
the guideline by testing both null and undefined (e.g., aVal === null || aVal
=== undefined and similarly for bVal) in the same comparator block (the function
around the existing aVal/bVal comparisons) so the null/undefined handling
remains equivalent but uses strict operators.
In `@eslint.config.js`:
- Line 2: Remove the duplicate import and consolidate to the unified
typescript-eslint export: drop the tseslint from
'@typescript-eslint/eslint-plugin' import and use the existing typescriptEslint
import (from 'typescript-eslint') everywhere; update the plugins object to
reference typescriptEslint.plugin (or the plugin property on the unified import)
and adjust any configs that referenced tseslint to use typescriptEslint.plugin
and typescriptEslint.parser as needed so only the single typescriptEslint symbol
is used for plugin/parser/config references.
- Around line 57-58: Remove the redundant globalIgnores call by deleting the
globalIgnores(['dist', 'node_modules']) entry; the ignores array already
contains 'dist/**' and 'node_modules/**', so keep the { ignores } export and
remove the globalIgnores(...) invocation to avoid duplicate patterns (refer to
the ignores array and the globalIgnores function call).
- Around line 52-54: The code is accessing typescript-eslint configs via the
nonexistent typescriptEslint.plugin.configs path; update the accessors to use
the v8 API: replace
typescriptEslint.plugin.configs['flat/recommended-type-checked'] with
typescriptEslint.configs.recommendedTypeChecked when building
tsTypeCheckedRecommended, and likewise replace
typescriptEslint.plugin.configs['flat/recommended'] with
typescriptEslint.configs.recommended where the standard recommended config is
referenced; keep the existing mapping logic that sets cfg.files when absent (the
tsTypeCheckedRecommended mapping and any use of the previous 'flat/recommended'
reference should be updated to the new identifiers).
In `@src/components/ai-elements/prompt-input.tsx`:
- Line 590: Replace compressed single-line conditional returns with the
multi-line brace style used elsewhere for consistency: change occurrences like
"if (!usingProvider) {return}" to a multi-line block with braces and a semicolon
on the return, and apply the same change for the other occurrences noted (the
checks using usingProvider at the other locations). Update the conditional
statements referencing the usingProvider variable so they follow the project's
multi-line if { ... } formatting.
In `@src/mastra/lib/http-client.ts`:
- Around line 16-17: Change the explicit any on the retryDelay callback
parameter to a safer type: replace "retryDelay?: (retryCount: number, error:
any) => number" with either "retryDelay?: (retryCount: number, error: unknown)
=> number" and narrow/cast inside the implementation, or import and use
AxiosError (e.g., "import type { AxiosError } from 'axios'" and then
"retryDelay?: (retryCount: number, error: AxiosError) => number") so the
retryDelay signature in http-client.ts no longer uses any.
In `@src/mastra/tools/tests/alpha-vantage.tool.test.ts`:
- Line 633: The single-line if statement in the test (the condition checking
"!data || typeof data.message !== 'string'") has braces but lacks spacing for
readability; update that statement to include spaces after the opening brace and
before the closing brace (i.e., change "{return false}" to "{ return false }")
so it complies with curly style and improves readability in the
alpha-vantage.tool.test assertion.
In `@src/mastra/tools/weather-tool.ts`:
- Around line 128-129: The object property currently uses the form
"tracingContext: tracingContext" with an accompanying "//
eslint-disable-next-line object-shorthand" comment; remove the eslint-disable
comment and convert the property to use object shorthand by replacing the
explicit key:value with just "tracingContext" where the object is constructed
(look for the object that contains the tracingContext property in
weather-tool.ts).
In `@ui/accordion.tsx`:
- Around line 7-12: The interface AccordionContextValue has an extraneous blank
line between the openItems member and the toggle member; remove that blank line
so members are listed consecutively (openItems, toggle, type) in the
AccordionContextValue interface to match typical formatting and eliminate the
awkward spacing.
| const handleCopy = useCallback(() => { | ||
| const doCopy = async () => { | ||
| try { | ||
| await navigator.clipboard.writeText(editedCode) | ||
| setCopied(true) | ||
| setTimeout(() => setCopied(false), 2000) | ||
| } catch (err) { | ||
| void err | ||
| } | ||
| } | ||
| void doCopy() | ||
| }, [editedCode]) |
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.
Inconsistent error handling compared to similar copy logic elsewhere.
The error is silently discarded with void err (Line 69), but in agent-web-preview.tsx (Line 155-157), the same copy operation logs the error with console.error('Failed to copy:', err). Consider logging the error for debugging consistency.
Proposed fix
const handleCopy = useCallback(() => {
const doCopy = async () => {
try {
await navigator.clipboard.writeText(editedCode)
setCopied(true)
setTimeout(() => setCopied(false), 2000)
} catch (err) {
- void err
+ console.error('Failed to copy:', err)
}
}
void doCopy()
}, [editedCode])🤖 Prompt for AI Agents
In `@app/chat/components/agent-artifact.tsx` around lines 62 - 73, The handleCopy
handler currently swallows clipboard errors (in doCopy's catch it does "void
err"); update the catch to log the error like the other component to aid
debugging — inside the doCopy catch block for
navigator.clipboard.writeText(editedCode) replace the silent discard with a
console.error('Failed to copy:', err) (or the project's logger if preferred) and
keep the existing setCopied/setTimeout behavior unchanged; reference handleCopy
and the inner doCopy async function to locate the change.
| import type { DynamicToolUIPart } from 'ai' | ||
| import type { ReactNode } from 'react' | ||
| import type { ToolInvocationState as ChatToolInvocationState } from '../providers/chat-context-types' | ||
|
|
||
| export interface Citation { | ||
| id: string | ||
| number: string | ||
| title: string | ||
| url: string | ||
| description?: string | ||
| quote?: string | ||
| id: string | ||
| number: string | ||
| title: string | ||
| url: string | ||
| description?: string | ||
| quote?: string | ||
| } | ||
|
|
||
| export interface AgentToolsProps { | ||
| tools: Array<ChatToolInvocationState | DynamicToolUIPart> | ||
| className?: string | ||
| tools: Array<ChatToolInvocationState | DynamicToolUIPart> | ||
| className?: string | ||
| } | ||
|
|
||
| export type TaskStepStatus = 'pending' | 'running' | 'completed' | 'error' | ||
|
|
||
| export interface TaskStep { | ||
| id: string | ||
| text: string | ||
| status: TaskStepStatus | ||
| file?: { | ||
| name: string | ||
| icon?: string | ||
| } | ||
| id: string | ||
| text: string | ||
| status: TaskStepStatus | ||
| file?: { | ||
| name: string | ||
| icon?: string | ||
| } | ||
| } | ||
|
|
||
| export interface AgentTaskData { | ||
| title: string | ||
| steps: TaskStep[] | ||
| title: string | ||
| steps: TaskStep[] | ||
| } | ||
|
|
||
| export interface ArtifactData { | ||
| id: string | ||
| title: string | ||
| description?: string | ||
| type: 'code' | 'markdown' | 'json' | 'text' | 'html' | 'react' | ||
| language?: string | ||
| content: string | ||
| id: string | ||
| title: string | ||
| description?: string | ||
| type: 'code' | 'markdown' | 'json' | 'text' | 'html' | 'react' | ||
| language?: string | ||
| content: string | ||
| } | ||
|
|
||
| export interface PlanStep { | ||
| text: string | ||
| completed?: boolean | ||
| text: string | ||
| completed?: boolean | ||
| } | ||
|
|
||
| export interface AgentPlanData { | ||
| title: string | ||
| description: string | ||
| steps: PlanStep[] | string[] | ||
| isStreaming?: boolean | ||
| currentStep?: number | ||
| title: string | ||
| description: string | ||
| steps: PlanStep[] | string[] | ||
| isStreaming?: boolean | ||
| currentStep?: number | ||
| } | ||
|
|
||
| export interface ReasoningStep { | ||
| id: string | ||
| label: string | ||
| description?: string | ||
| status: 'complete' | 'active' | 'pending' | ||
| searchResults?: string[] | ||
| duration?: number | ||
| id: string | ||
| label: string | ||
| description?: string | ||
| status: 'complete' | 'active' | 'pending' | ||
| searchResults?: string[] | ||
| duration?: number | ||
| } | ||
|
|
||
| export interface AgentSuggestionsProps { | ||
| suggestions: string[] | ||
| // eslint-disable-next-line no-unused-vars | ||
| onSelect: (suggestion: string) => void | ||
| disabled?: boolean | ||
| className?: string | ||
| suggestions: string[] | ||
| onSelect: (suggestion: string) => void | ||
| disabled?: boolean | ||
| className?: string | ||
| } | ||
|
|
||
| export interface AgentSourcesProps { | ||
| sources: Array<{ url: string; title: string }> | ||
| className?: string | ||
| maxVisible?: number | ||
| sources: Array<{ url: string; title: string }> | ||
| className?: string | ||
| maxVisible?: number | ||
| } | ||
|
|
||
| export interface AgentReasoningProps { | ||
| reasoning: string | ||
| isStreaming: boolean | ||
| duration?: number | ||
| className?: string | ||
| reasoning: string | ||
| isStreaming: boolean | ||
| duration?: number | ||
| className?: string | ||
| } | ||
|
|
||
| export type ConfirmationSeverity = 'info' | 'warning' | 'danger' | ||
|
|
||
| export interface QueuedTask { | ||
| id: string | ||
| title: string | ||
| description?: string | ||
| status: 'pending' | 'running' | 'completed' | 'failed' | ||
| createdAt?: Date | ||
| completedAt?: Date | ||
| error?: string | ||
| id: string | ||
| title: string | ||
| description?: string | ||
| status: 'pending' | 'running' | 'completed' | 'failed' | ||
| createdAt?: Date | ||
| completedAt?: Date | ||
| error?: string | ||
| } | ||
|
|
||
| export interface WebPreviewData { | ||
| id: string | ||
| url: string | ||
| title?: string | ||
| code?: string | ||
| language?: string | ||
| html?: string | ||
| editable?: boolean | ||
| showConsole?: boolean | ||
| height?: number | ||
| id: string | ||
| url: string | ||
| title?: string | ||
| code?: string | ||
| language?: string | ||
| html?: string | ||
| editable?: boolean | ||
| showConsole?: boolean | ||
| height?: number | ||
| } | ||
|
|
||
| export type InlineCitationRender = ReactNode[] |
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
Formatting changes look good; consider completing array syntax standardization.
The formatting improvements and import reordering are consistent and non-breaking. All type-only imports correctly use import type, and interface definitions follow proper conventions.
However, there's a minor inconsistency with the PR's objective to standardize array typing to Array<Type> syntax:
- Line 15 correctly uses:
Array<ChatToolInvocationState | DynamicToolUIPart> - Lines 33 and 53 still use bracket notation:
TaskStep[]andPlanStep[] | string[]
📝 Optional: Complete array syntax standardization
For full consistency with the standardization effort, consider updating the remaining array types:
export interface AgentTaskData {
title: string
- steps: TaskStep[]
+ steps: Array<TaskStep>
} export interface AgentPlanData {
title: string
description: string
- steps: PlanStep[] | string[]
+ steps: Array<PlanStep> | Array<string>
isStreaming?: boolean
currentStep?: number
}🤖 Prompt for AI Agents
In `@app/chat/components/chat.types.ts` around lines 1 - 111, Convert remaining
bracket-style array types to generic Array<T> for consistency: change TaskStep[]
in AgentTaskData.steps to Array<TaskStep>, change PlanStep[] | string[] in
AgentPlanData.steps to Array<PlanStep> | Array<string>, change
AgentSuggestionsProps.suggestions from string[] to Array<string>, and change
InlineCitationRender from ReactNode[] to Array<ReactNode>; update only the type
annotations (no runtime logic).
| // Actions | ||
| // eslint-disable-next-line no-unused-vars | ||
|
|
||
| sendMessage: (text: string, files?: File[]) => void | ||
| stopGeneration: () => void | ||
| clearMessages: () => void | ||
| // eslint-disable-next-line no-unused-vars | ||
|
|
||
| selectAgent: (agentId: string) => void | ||
| // eslint-disable-next-line no-unused-vars | ||
|
|
||
| selectModel: (modelId: string) => void | ||
| dismissError: () => void | ||
| // eslint-disable-next-line no-unused-vars | ||
|
|
||
| setFocusMode: (enabled: boolean) => void | ||
|
|
||
| // Task management | ||
| // eslint-disable-next-line no-unused-vars | ||
|
|
||
| addTask: (task: Omit<QueuedTask, 'id'>) => string | ||
| // eslint-disable-next-line no-unused-vars | ||
|
|
||
| updateTask: (taskId: string, updates: Partial<QueuedTask>) => void | ||
| // eslint-disable-next-line no-unused-vars | ||
|
|
||
| removeTask: (taskId: string) => void | ||
|
|
||
| // Confirmation management | ||
| // eslint-disable-next-line no-unused-vars | ||
|
|
||
| approveConfirmation: (confirmationId: string) => void | ||
| // eslint-disable-next-line no-unused-vars | ||
|
|
||
| rejectConfirmation: (confirmationId: string, reason?: string) => void | ||
| // Checkpoint management | ||
| // eslint-disable-next-line no-unused-vars | ||
|
|
||
| createCheckpoint: (messageIndex: number, label?: string) => string | ||
| // eslint-disable-next-line no-unused-vars | ||
|
|
||
| restoreCheckpoint: (checkpointId: string) => void | ||
| // eslint-disable-next-line no-unused-vars | ||
|
|
||
| removeCheckpoint: (checkpointId: string) => void | ||
| // Web Preview management | ||
| // eslint-disable-next-line no-unused-vars | ||
|
|
||
| setWebPreview: (preview: WebPreviewData | null) => void | ||
| // Memory management | ||
| // eslint-disable-next-line no-unused-vars | ||
|
|
||
| setThreadId: (threadId: string) => void | ||
| // eslint-disable-next-line no-unused-vars | ||
|
|
||
| setResourceId: (resourceId: string) => void |
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
Remove excessive blank lines in interface methods.
The removed ESLint disable comments left behind blank lines between method signatures. While this doesn't affect functionality, multiple consecutive blank lines within an interface reduce readability. Consider removing some of these blank lines for cleaner formatting.
🤖 Prompt for AI Agents
In `@app/chat/providers/chat-context-types.ts` around lines 105 - 145, The
interface in chat-context-types.ts has extra blank lines left by removed ESLint
comments; clean up the spacing by removing consecutive empty lines between
method signatures (e.g., sendMessage, stopGeneration, clearMessages,
selectAgent, selectModel, dismissError, setFocusMode, addTask, updateTask,
removeTask, approveConfirmation, rejectConfirmation, createCheckpoint,
restoreCheckpoint, removeCheckpoint, setWebPreview, setThreadId, setResourceId)
so each method is separated consistently (single blank line or none) to improve
readability.
| import type { ReactNode} from 'react'; | ||
| import { useState } from 'react' |
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
Good separation of type-only imports.
Separating ReactNode as a type-only import aligns with the coding guidelines for using import type for type declarations.
Minor formatting note: Line 3 has inconsistent spacing (ReactNode} vs ReactNode }) and semicolon usage differs from line 4.
🔧 Optional formatting fix
-import type { ReactNode} from 'react';
-import { useState } from 'react'
+import type { ReactNode } from 'react'
+import { useState } from 'react'📝 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 type { ReactNode} from 'react'; | |
| import { useState } from 'react' | |
| import type { ReactNode } from 'react' | |
| import { useState } from 'react' |
🤖 Prompt for AI Agents
In `@app/components/api-components.tsx` around lines 3 - 4, Fix the minor import
formatting: ensure the type-only import reads with proper spacing around the
brace (ReactNode -> ReactNode }) and make semicolon usage consistent between
imports. Update the import lines so they use the same semicolon convention and
spacing—e.g., change the type import to "import type { ReactNode } from
'react';" and match the useState import punctuation/semicolons accordingly in
app/components/api-components.tsx.
| // Let provider know about our hidden file input so external menus can call openFileDialog() | ||
| useEffect(() => { | ||
| if (!usingProvider) return | ||
| if (!usingProvider) {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
Inconsistent single-line brace formatting.
The early returns and conditional statements use a compressed single-line format (if (cond) {return}) that differs from the multi-line style used elsewhere in this file (e.g., lines 186-188, 202-204). For consistency and readability, consider using the same multi-line format throughout.
♻️ Suggested formatting for consistency
- if (!usingProvider) {return}
+ if (!usingProvider) {
+ return
+ }- if (!form) {return}
+ if (!form) {
+ return
+ }- if (!globalDrop) {return}
+ if (!globalDrop) {
+ return
+ }- if (f.url) {URL.revokeObjectURL(f.url)}
+ if (f.url) {
+ URL.revokeObjectURL(f.url)
+ }Also applies to: 607-607, 631-631, 658-658
🤖 Prompt for AI Agents
In `@src/components/ai-elements/prompt-input.tsx` at line 590, Replace compressed
single-line conditional returns with the multi-line brace style used elsewhere
for consistency: change occurrences like "if (!usingProvider) {return}" to a
multi-line block with braces and a semicolon on the return, and apply the same
change for the other occurrences noted (the checks using usingProvider at the
other locations). Update the conditional statements referencing the
usingProvider variable so they follow the project's multi-line if { ... }
formatting.
|
|
||
| retryDelay?: (retryCount: number, error: any) => number |
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
Replace any with a proper type for the error parameter.
Removing the ESLint disable comment is good cleanup, but the error: any parameter on line 17 now violates the coding guideline to avoid explicit any types. Consider using unknown or the more specific AxiosError type.
♻️ Suggested fix
+import type { AxiosError, AxiosInstance, AxiosRequestConfig } from 'axios'
-import type { AxiosInstance, AxiosRequestConfig } from 'axios'- retryDelay?: (retryCount: number, error: any) => number
+ retryDelay?: (retryCount: number, error: AxiosError) => numberAs per coding guidelines, use proper types or unknown instead of explicit any.
🤖 Prompt for AI Agents
In `@src/mastra/lib/http-client.ts` around lines 16 - 17, Change the explicit any
on the retryDelay callback parameter to a safer type: replace "retryDelay?:
(retryCount: number, error: any) => number" with either "retryDelay?:
(retryCount: number, error: unknown) => number" and narrow/cast inside the
implementation, or import and use AxiosError (e.g., "import type { AxiosError }
from 'axios'" and then "retryDelay?: (retryCount: number, error: AxiosError) =>
number") so the retryDelay signature in http-client.ts no longer uses any.
| (c: any) => { | ||
| const data = c[0]?.data | ||
| if (!data || typeof data.message !== 'string') return false | ||
| if (!data || typeof data.message !== 'string') {return false} |
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
Minor formatting suggestion for readability.
The curly braces addition correctly satisfies the curly: ['error', 'all'] ESLint rule. Consider adding spaces for better readability.
✨ Suggested formatting improvement
- if (!data || typeof data.message !== 'string') {return false}
+ if (!data || typeof data.message !== 'string') {
+ return false
+ }📝 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.
| if (!data || typeof data.message !== 'string') {return false} | |
| if (!data || typeof data.message !== 'string') { | |
| return false | |
| } |
🤖 Prompt for AI Agents
In `@src/mastra/tools/tests/alpha-vantage.tool.test.ts` at line 633, The
single-line if statement in the test (the condition checking "!data || typeof
data.message !== 'string'") has braces but lacks spacing for readability; update
that statement to include spaces after the opening brace and before the closing
brace (i.e., change "{return false}" to "{ return false }") so it complies with
curly style and improves readability in the alpha-vantage.tool.test assertion.
| // eslint-disable-next-line object-shorthand | ||
| tracingContext: tracingContext, |
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.
Remove ESLint disable comment and use object shorthand.
This contradicts the PR objective of removing unnecessary ESLint disable comments. Per coding guidelines, use object shorthand syntax instead of { name: name }.
Proposed fix
- // eslint-disable-next-line object-shorthand
- tracingContext: tracingContext,
+ tracingContext,📝 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.
| // eslint-disable-next-line object-shorthand | |
| tracingContext: tracingContext, | |
| tracingContext, |
🤖 Prompt for AI Agents
In `@src/mastra/tools/weather-tool.ts` around lines 128 - 129, The object property
currently uses the form "tracingContext: tracingContext" with an accompanying
"// eslint-disable-next-line object-shorthand" comment; remove the
eslint-disable comment and convert the property to use object shorthand by
replacing the explicit key:value with just "tracingContext" where the object is
constructed (look for the object that contains the tracingContext property in
weather-tool.ts).
| interface AccordionContextValue { | ||
| openItems: string[] | ||
| // eslint-disable-next-line no-unused-vars | ||
|
|
||
| toggle: (value: string) => void | ||
| type: 'single' | 'multiple' | ||
| } |
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 removing the leftover blank line in the interface.
The ESLint disable comment removal is good, but the remaining blank line at line 9 creates awkward spacing within the interface definition. Interface members are typically listed without blank lines between them unless there's a logical grouping.
✨ Suggested cleanup
interface AccordionContextValue {
openItems: string[]
-
toggle: (value: string) => void
type: 'single' | 'multiple'
}📝 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.
| interface AccordionContextValue { | |
| openItems: string[] | |
| // eslint-disable-next-line no-unused-vars | |
| toggle: (value: string) => void | |
| type: 'single' | 'multiple' | |
| } | |
| interface AccordionContextValue { | |
| openItems: string[] | |
| toggle: (value: string) => void | |
| type: 'single' | 'multiple' | |
| } |
🤖 Prompt for AI Agents
In `@ui/accordion.tsx` around lines 7 - 12, The interface AccordionContextValue
has an extraneous blank line between the openItems member and the toggle member;
remove that blank line so members are listed consecutively (openItems, toggle,
type) in the AccordionContextValue interface to match typical formatting and
eliminate the awkward spacing.
- Refactor `AgentConfirmationProps` to remove unnecessary line breaks. - Add new icons (`ActivityIcon`, `NetworkIcon`) to `chat-messages.tsx`. - Implement type guards for various data parts in `chat-messages.tsx`. - Create `AgentDataSection`, `WorkflowDataSection`, and `NetworkDataSection` components for rendering nested execution results. - Update `NestedAgentChat` to handle form submission asynchronously and log errors. - Modify `network-chat.tsx` to handle clipboard actions asynchronously. - Improve error handling in `NetworkProvider` and `WorkflowProvider` for message sending and stopping execution. - Remove deprecated `maskSensitiveMessageData` function from `pg-storage.ts`. - Update `formatStorageMessages` to directly push messages to `messageData.parts` based on operation status.

typetointerfacefor better extensibility in components such asPieSlice,ConfirmationContextValue, andQueueMessagePart.Array<Type>instead ofType[]) in components likeDataTablePropsandAttachmentsContext.voidfor fire-and-forget function calls, ensuring no promises are returned where void is expected, particularly inChatProviderandWorkflowActions.useDebounceanduseToggle.Summary by Sourcery
Refine TypeScript types and React component contracts for stronger type safety while tightening ESLint configuration for stricter, type-aware linting across the codebase.
Enhancements:
Build:
Tests:
Chores: