-
Notifications
You must be signed in to change notification settings - Fork 748
Feature/consensusfeat(chat): Add validation to fileRead, ListDir and ExecBash tool #7007
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
Closed
Conversation
This file contains hidden or 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
… for agentic chat"
feat(chat):Added chat history storage to the Q chat for agentic chat
feat(chat): Updated model for Q Agnetic Chat APIs.
## Problem
Amazon Q Agentic Chat needs the ability to read files and directories
from the user's workspace to provide context-aware assistance.
Currently, there's no tool available for Amazon Q to access the file
system in a controlled and secure manner.
## Solution
- Implemented a new fsRead tool that allows Amazon Q to:
- Read entire files or specific line ranges
- List directory contents with configurable depth
- Handle error cases gracefully with informative messages
- Enforce size limits (30KB) to prevent excessive memory usage
## Testing
```
FsRead Unit Tests
extensionHostProcess.js:178
✔ reads entire file
extensionHostProcess.js:178
✔ reads partial lines of a file
extensionHostProcess.js:178
✔ lists directory contents up to depth = 1
extensionHostProcess.js:178
✔ throws error if path does not exist
extensionHostProcess.js:178
✔ throws error if content exceeds 30KB
extensionHostProcess.js:178
✔ invalid line range
```
---
- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.
feat(chat): Add validate method to fsRead tool
feat(chat): add fsWrite tool create command
## Problem Setting up new Q Agentic Chat loop with tool use. ## Solution Initial Agentic Chat loop Setup with tool use --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
feat(chat): add fsWrite tool commands
feat(amazonq): Adding openDiff and acceptDiff UX to the agentic chat.
feat(chat): Add executeBash tool for Amazon Q Agentic Chat
feat(chat): fix for q agentic chat loop
) ## Problem Support workflows with multiple file writes without confirmation ## Solution - Set `requiresAcceptance` to `false` for all FsWrite executions - Store backups of each FsWrite so we can revert the changes if needed --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
## Problem Users lose all chats when they close VSCode, and there's no way to browse through chat history. Users also cant export their conversations to an easily shareable format. ## Solution Automatically persist conversations to JSON files in ~/.aws/amazonq/history, one for each workspace where Amazon Q chats occur. Add chat history and chat export buttons to top of Amazon Q toolbar. Clicking on the chat history button allows users to browse and search through chat history. Users click on an old conversation to open it back up (currently open conversations are in bold). Clicking on chat export button allows users to save chat transcript as a markdown or html. Note: persistence + history is only for Q Chat Tabs (not /dev, /doc, /transform, etc.)  ## Note Agentic chat does not currently use this persisted history in it's context. Follow-up PR will address this issue. --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
## Problem Longer streaming responses are throwing ECONNRESET ## Solution Increase the default timeout --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
…6966) ## Problem - after user click the reject button of running shell command, we call LLM to get response of shell command rejection ## Solution  --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
## Problem Context is shown repeatedly in the UI if it is provided. <img width="754" alt="image" src="https://github.com/user-attachments/assets/30f51f7c-e504-46a6-b416-9bbd9b06023e" /> ## Solution - Separate initial stream and context messages into separate functions - Only show context on the first message of the loop <img width="679" alt="image" src="https://github.com/user-attachments/assets/aefca516-e04f-4a29-b6e4-92236acc37c8" /> --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
Remove static response string for shell command reject ## Problem - Use shell icon in shell command header - Remove static response string for shell command reject ## Solution  --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
…ge (aws#6977) ## Problem Before we are unclear about the commands' category and sometimes we show warning for some wide-used commands. Also we want to show the different warning message for destructive commands and mutable commands. ## Solution --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
## Notes
- fix(chat): Improve diffView UX, changes include:
- Remove the icon in diff view
- Clean up temp files when accept or reject
- Do not open the files as they generate
---
- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.
## Problem The pair-program was off by default and there was no tooltip. ## Solution  --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
fix(chat): Send back throttling error message
## Problem Chat input prompt should be disabled during the agentic loop ## Solution - Disable chat prompt - Removed stop button for now --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
fix(chat): handle JSON.parse error gracefully
## Problem - We show read tool message for each file read which is occupying the entire chat with these messages which is not super important. ## Solution - Group all the read tool messaged under ContextList.  --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
…ve file (aws#6989) ## Problem ``` An error occurred while processing your request.This error is reported to the team automatically. We will attempt to fix it as soon as possible.Details: Input is too long. ``` - A bug where status code is not being populated in error message - A bug where output log window can be considered as active file which can cause waste of tokens - A bug where toolUse JSON.parse is not being handled correctly ## Solution - Prune history if it's too large - Fix status code bug in error message - Fix active file bug - Fix JSON.parse handling --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
…ws#6995) ## Problem - fix shell command execution output markdown block issue - When the child process of bash command execution writes to both stdout and stderr, we need to main the output is processed in the exact order it was generated by the child process. ## Solution - Before this change  - After this change  --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
## Problem - Reverting PR: aws#6975 as this is causing regression in some cases. ## Solution --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
## Problem - ToolUse input is empty when parsing fails which breaks history ## Solution - Fix toolUse input is missing when parsing fails --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
## Problem - Markdown headers are too large - `no-padding` from mynah-ui is not working Before:   ## Solution - Override the font size for h1-h4 - Override the padding for any card under `no-padding` After:   --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
## Problem - currently no metrics for agentic chat ## Solution Emit telemetry events when: - message shown to user (message sent from user already exists) - diff was generated - user rejected diff - command was generated - user accepted command - user pressed stop button - upstreamed metric to aws-toolkit-common: aws/aws-toolkit-common#1010 #### TODO: - additional telemetry events for: user interrupts Q while generating, thumbs up/down - see when user pressed stop (ex: chat, command execution, etc) --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
We should ask for user consensus when tools accessing files/dirs outside of workspace
Solution
Add validation step when accessing files/dirs outside of workspace using fsRead or listDirectories tools.
feature/xbranches will not be squash-merged at release time.