-
Notifications
You must be signed in to change notification settings - Fork 327
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(context-agent): move Deep Cody out of model dropdown (#6513)
Adds on #6513 CLOSE https://linear.app/sourcegraph/issue/CODY-4535 https://linear.app/sourcegraph/issue/CODY-4563 https://linear.app/sourcegraph/issue/CODY-4539 Building blocks of https://www.loom.com/share/16b55f92368844b4b766083ed4d30091 This PR introduces a new UI-based approach for managing Cody's agent capabilities, replacing the previous VS Code settings configuration. It also moves Deep Cody out of the model dropdown into its own Agent Settings component ## Key Changes 1. New Agent UI Controls: - Added `ToolboxButton` component in chat input area with: - Bot icon indicating agent status (active/inactive) - Green pulse animation for active state - Popover menu for settings - Dedicated switches for agent and terminal features 2. Deep Cody Architecture Improvements: - Simplified agent ID for Deep Cody to 'deep-cody' from previous ModelRef format - Added support for model selection between default chat model and Claude 3.5 Haiku - Moved shell context permission to UI toggle with warning message - Enhanced context handling with deduplication for repeated queries 3. API & Type Updates: - Added `toolboxSettings` and `updateToolboxSettings` to WebView API - Updated `AgentToolboxSettings` type to use string-based agent ID - Enhanced message types to support agent attribution - Added feature flag for chat model selection 4. Code Organization: - Refactored `CodyToolProvider` into namespace pattern - Improved tool factory initialization and management - Enhanced test coverage for new UI components - Removed deprecated VS Code settings 5. Default Model - Defaulted to use 3.5 Haiku as the reflection model - When the `ContextAgentDefaultChatModel` feature flag is enabled on the instance, reflection model will be set to Sonnet instead 6. Merge CodyChatAgent with DeepCodyAgent. 7. Introduce ToolboxManager and AgentToolboxSettings - Added a `ToolboxManager` class to centralize the management of agent toolbox settings, including the terminal/shell context. - Introduced the `AgentToolboxSettings` interface to represent the user's preferences for the agent and terminal context. - Integrated the `ToolboxManager` into the `ChatController` to update the user's terminal context setting based on the configuration. - Persisted the agent and terminal context settings in the local storage for user-specific preferences. - ToolboxManager settings for terminal context gets updated on user config changes 8. Improve prompt and response format for context review - Enhance the review prompt to provide clearer instructions and the expected response format. - Add new tags for context and answers to standardize the response structure. - Provide examples of valid and invalid responses to guide the user. - Update the prompt to emphasize the importance of only including the expected tags in the response. - Integrate the ToolboxManager into the ChatController to update the user's terminal context setting based on the configuration. - Persist the agent and terminal context settings in the local storage for user-specific preferences. 9. Improve context retrieval for deep-cody / context agent - send context to webview for display before sending the request - update context retrieval to only include validated context items that match the end of the path - post empty message in progress when processing steps are updated ## TO-DO Will be continued in follow-ups: - [ ] Update Deep Cody Notice / upsell with the new changes - [ ] Remove Deep Cody rate limit - [ ] Update Agentic context UI - [ ] Update New toolbox setting UI ## Test plan <!-- Required. See https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles. --> Updated all existing unit tests and added new unit tests to cover all the Deep Cody components. Deep Cody should work as it does currently: Example Question: `how many files are there in the root of my codebase? Find where PromptSelectField is defined in the codebase` ![image](https://github.com/user-attachments/assets/3cbfa27a-b66c-453a-ad59-db8abffc4005) In UI, enabling the Terminal Context Agent would enable terminal context ![image](https://github.com/user-attachments/assets/72545f53-0aac-48cd-b585-6a066f6bac0a) In UI, disabling the Terminal Context Agent would disable terminal context ![image](https://github.com/user-attachments/assets/5b5d27ec-e5a5-49b5-a776-e4332d8d8709) 1. Agent Controls: - [x] Verify bot icon appears in chat input - [x] Check icon states (active/inactive) - [x] Confirm green pulse animation when active - [x] Test settings popover interaction 2. Settings Management: - [x] Enable/disable agent via toggle - [x] Toggle terminal access (when available) - [x] Verify warning message for terminal access - [x] Confirm settings persist across sessions 3. Chat Experience: - [x] Test chat with agent enabled/disabled - [x] Verify model selection works correctly - [x] Check context gathering improvements - [x] Confirm terminal integration (when enabled) 4. Settings Transition: - [x] Verify existing setting is not respected and is marked as deprecated - [x] The Terminal context is disabled by default in the new UI component - [x] Test default states as PLG and Enterprise users - [x] Check settings sync behavior ## Changelog <!-- OPTIONAL; info at https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c --> --------- Co-authored-by: Valery Bugakov <[email protected]>
- Loading branch information
1 parent
77df8d2
commit fabed61
Showing
42 changed files
with
1,441 additions
and
682 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.