-
Notifications
You must be signed in to change notification settings - Fork 60
AXON-1596: Agent mode #1532
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
base: main
Are you sure you want to change the base?
AXON-1596: Agent mode #1532
Conversation
src/rovo-dev/ui/prompt-box/prompt-settings-popup/PromptSettingsPopup.tsx
Show resolved
Hide resolved
src/rovo-dev/ui/prompt-box/prompt-settings-popup/AgentModeSection.tsx
Outdated
Show resolved
Hide resolved
| } catch (error) { | ||
| const errorMessage = error instanceof Error ? error.message : String(error); | ||
| RovoDevLogger.error(new Error(`Failed to initialize agent mode: ${errorMessage}`)); | ||
| } |
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 Design - Error Management
The error handling in setReady logs the error but continues execution, which might leave the agent mode in an inconsistent state.
Details
📖 Explanation: Consider setting a default fallback mode or rethrowing the error to ensure the application state remains consistent when agent mode initialization fails.
| <Box | ||
| key={modeInfo.mode} | ||
| xcss={styles.modeItem} | ||
| onClick={() => setAgentMode(modeInfo.mode as AgentMode)} |
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 Design - Model Structure
The RovoDevModeInfo.mode field uses string type which could allow invalid modes to be passed to setAgentMode that expects AgentMode union type.
Details
📖 Explanation: The type cast as AgentMode could fail at runtime if the API returns a mode not in the AgentMode union, leading to unexpected behavior in the application.
| break; | ||
|
|
||
| case RovoDevViewResponseType.GetAvailableAgentModes: | ||
| const modes = await this._chatProvider.getAvailableAgentModes(); |
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 agent modes should be sent to the front end on initialization so the user is not waiting for the modes after page load
What Is This Change?
This pull request introduces support for agent modes in the Rovo Dev extension, including backend API integration, state management, and frontend messaging. It adds the ability to get and set the agent mode (
ask,default,plan), retrieve available modes, and communicate these changes between the extension and the webview UI. The changes include new API client methods, interface definitions, state handling in the chat provider, message types, and corresponding tests and UI updates.https://www.loom.com/share/af22caad395a4f5c8c3ccbcd1c9a4189
Agent Mode API Integration:
RovoDevApiClientfor getting, setting, and listing agent modes (getAgentMode,setAgentMode,getAvailableModes), along with error handling and relevant interface definitions (AgentMode,RovoDevGetAgentModeResponse, etc.).Agent Mode State Management:
RovoDevChatProvider, including initialization from the API, getters/setters, and public methods for interacting with agent mode and available modes.Webview Messaging and UI Communication:
RovoDevWebviewProviderto handle agent mode requests (get/set/current/available) and send completion messages to the webview.RovoDevProviderMessageTypeandRovoDevProviderMessagefor agent mode operations.UI and Styling Updates:
PromptInputItemsto separated component to improve readabilityInternal Improvements:
Dependency Update:
@atlaskit/primitivestopackage.jsondependencies.How Has This Been Tested?
Basic checks:
npm run lintnpm run test