feat(agent-service): add Mastra thread rollback APIs and undo test app - #5675
feat(agent-service): add Mastra thread rollback APIs and undo test app#5675solittlework wants to merge 1 commit into
Conversation
Adds thread list/messages/clear/rollback endpoints on AgentBroker, mock-agent for local undo demos, ai-undo-app, and rollback docs.
| ); | ||
| } | ||
|
|
||
| function LoginPage() { |
There was a problem hiding this comment.
🟡 Clean Code — Rule 2.3 WARNING
The LoginPage function exceeds the recommended function length of 50 lines, making it harder to read and maintain.
💡 Suggestion: Consider extracting parts of the LoginPage logic, such as the form or error handling, into smaller components or helper functions.
To suppress: add // clean-code-ignore: 2.3 on this line
| ); | ||
| } | ||
|
|
||
| function ChatPage() { |
There was a problem hiding this comment.
🟡 Clean Code — Rule 2.3 WARNING
The ChatPage function exceeds the recommended function length of 50 lines, making it harder to read and maintain.
💡 Suggestion: Consider extracting parts of the ChatPage logic, such as the header or error banner, into smaller components.
To suppress: add // clean-code-ignore: 2.3 on this line
| return <Navigate to="/chat" replace />; | ||
| } | ||
|
|
||
| const onSubmit = async (event: FormEvent) => { |
There was a problem hiding this comment.
🟡 Clean Code — Rule 2.10 WARNING
The onSubmit function in LoginPage handles both form submission and error handling, which are two distinct responsibilities.
💡 Suggestion: Consider extracting the error handling logic into a separate function to improve clarity and maintainability.
To suppress: add // clean-code-ignore: 2.10 on this line
|
|
||
| const AuthContext = createContext<AuthState | null>(null); | ||
|
|
||
| export function AuthProvider({ children }: { children: ReactNode }) { |
There was a problem hiding this comment.
🟡 Clean Code — Rule 2.3 WARNING
The AuthProvider function exceeds the recommended maximum function length of 50 lines.
💡 Suggestion: Consider extracting the useEffect logic or other parts of the function into smaller, reusable helper functions to improve readability and maintainability.
To suppress: add // clean-code-ignore: 2.3 on this line
| const [displayName, setDisplayName] = useState<string | null>(null); | ||
| const [error, setError] = useState<string | null>(null); | ||
|
|
||
| useEffect(() => { |
There was a problem hiding this comment.
🟡 Clean Code — Rule 2.4 WARNING
The conditional logic inside the useEffect hook is complex and could benefit from being extracted into a named helper function.
💡 Suggestion: Extract the logic inside the useEffect hook into a separate function, such as initializeAuthState, to improve readability and reusability.
To suppress: add // clean-code-ignore: 2.4 on this line
| import { getStoredRealm } from './auth/keycloak'; | ||
| import { ChatBox } from './chat/ChatBox'; | ||
|
|
||
| function LoadingScreen() { |
There was a problem hiding this comment.
⭐ Clean Code — Positive Feedback PRAISE
The LoadingScreen component is simple, focused, and reusable, adhering to the single responsibility principle.
| return <Navigate to="/chat" replace />; | ||
| } | ||
|
|
||
| const onSubmit = async (event: FormEvent) => { |
There was a problem hiding this comment.
⭐ Clean Code — Positive Feedback PRAISE
The onSubmit function in LoginPage is well-structured, with clear error handling and state management.
| ); | ||
| } | ||
|
|
||
| export default function App() { |
There was a problem hiding this comment.
⭐ Clean Code — Positive Feedback PRAISE
The App component is cleanly structured with clear routing logic, making it easy to understand and maintain.
Adds thread list/messages/clear/rollback endpoints on AgentBroker, mock-agent for local undo demos, ai-undo-app, and rollback docs.