Skip to content

Conversation

@avi-alpert
Copy link
Contributor

Problem

Users are unable to specify files or folders to add as context in a conversation. Additionally, when using @workspace, users don't know exactly which of their local files are being sent to Amazon Q.

Solution

Users can enter @ to add folders, files, and saved prompts as context. The response from Amazon Q now displays a "Context" list with all the items sent as context.


  • 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.
  • License: I confirm that my contribution is made under the terms of the Apache 2.0 license.

aws-toolkit-automation and others added 30 commits February 18, 2025 20:25
* local ws working

* beta_2

* rename

* update

* code format

* apply context cmd to all tabs

* context to the api call

* minimize changes

* update

* update

* format code

* update to lsp

* update context commands

* update context commands

* clean up

* beta5

* update

* use lsp to resolve additionalContext
* feat(amazonq): saved prompts

* fix: remove unecessary change
* feat(amazonq): saved prompts

* fix: remove unecessary change

* feat(amazonq): saved prompts

* fix: remove unecessary change

* feat(amazonq): add Create a new prompt button to context
* Add context transparency feature to Q chat @workspace

* remove console log

* remove console log

* remove unused FileClickMessage
* feat(amazonq): saved prompts

* fix: remove unecessary change

* feat(amazonq): saved prompts

* fix: remove unecessary change

* fix: add fs exists check for ~/.aws/prompts

* fix: whitespace
* fix: @workspace command

* remove first instance of workspace from message
* fix: add feature flag command to context

* fix: move into additional commands
* fix: refresh prompt list when project prompt is added

* fix: validate length and size of additionalContents

* fix: truncate additionalContents based on api validation limits

* fix: move constants
* context transparency multiple fixes

1. add manually selected context from prompt into context list
2. fix -1 start/end line edge cases
3. Center selction after clicking on the file

* remove console.log
aws-toolkit-automation and others added 18 commits February 25, 2025 18:11
## Problem
This is a band-aid to temporarily set the size of
`relevantTextDocuments` and `additionalContentEntry[]` combined to be
lower than 40k characters, due to limitations on the service side. This
PR will fix the issue when the API returns validation exception.

## Solution

1. Truncation is performed at chunk level. 
2. Prioritize `additionalContentEntry[]` over `relevantTextDocuments`
3. Added TODO for a total character count indicator.



---

- 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


## 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
Strings were hardcoded in .ts and test files. Input placeholder text did
not include information about using @ to insert context

## Solution
Move strings to language file, update placeholder text to match figma.

---

- 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
1. If user create a file using the File>New File buttons, the
onCreateFile listener does not capture it.

<img width="451" alt="Screenshot 2025-02-26 at 2 46 31 PM"
src="https://github.com/user-attachments/assets/e2e53d38-ca0e-413a-91f9-b2845b3549a6"
/>

2. Renaming file or folders is not listened and updated.

## Solution
1. Listen to new files created by File>New File buttons
2. Listen to renaming file or folders 

---

- 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
In certain rare cases, when the changed file has no dot in filename,
this file was misread as folders in the older LSP. Now this bug is fixed
in 0.1.42 lsp.

## Solution
update lsp artifact to 0.1.42

---

- 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
We need to update to mynahui beta 12

## 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
File list in header flickers as message is rendering (see screen
recording)


https://github.com/user-attachments/assets/485c665f-cde1-4ed6-a316-8cea2ac63a49


## Solution
Update to latest mynah beta. Pass `undefined` to `header` in subsequent
messages (as instructed by Mynah UI team)


Note: no fix in changelog needed since feature hasnt yet been released

---

- 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.
This PR adds the following telemetry for falcon features:

**New metric**: `amazonq_createSavedPrompt` - tracks when user creates a
saved prompt using UX. Adding to commons in this
[PR](aws/aws-toolkit-common#986)

**Additing to existing metric**: `amazonq_addMessage` (does not exist in
toolkit common):

- `cwsprChatHasContextList` - true if context list is displayed to user
- `cwsprChatPromptContextCount` - # of saved prompts manually added to
context
- `cwsprChatPromptContextLength` - Total length of saved prompts added
to context
- `cwsprChatPromptContextTruncatedLength` - Truncated length of saved
prompts added to context
- `cwsprChatRuleContextCount` - # of workspace rules automatically added
to context
- `cwsprChatRuleContextLength` - Total length of workspace rules added
to context
- `cwsprChatRuleContextTruncatedLength` - Truncated length of workspace
rules added to context
- `cwsprChatFileContextCount` - # of files manually added to context
- `cwsprChatFileContextLength` - Total length of files added to context
- `cwsprChatFileContextTruncatedLength` - Truncated length of files
added to context
- `cwsprChatFolderContextCount` - # of folders manually added to context



Telemetry doc:
https://quip-amazon.com/XRRfA9b8Ux24/Falcon-Telemetry-Toolkits-telemetry




---

- 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:
- We need to update copy text

Solution:
- Move hardcoded strings to language file
- Update titles/descriptions of new Context menu options
- Update welcome message to include new context menu options
- Update mynah-ui to latest
- add changelog for all falcon features


---

- 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.
@avi-alpert avi-alpert requested review from a team as code owners March 4, 2025 13:43
@avi-alpert
Copy link
Contributor Author

/runIntegrationTests

Copy link
Contributor

@Jurredr Jurredr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had a quick look through, LGTM! Excellent work guys.

@avi-alpert
Copy link
Contributor Author

E2E test failure: Amazon Q Chat Sends message is flaky, its been failing on other commits (https://d1ihu6zq92vp9p.cloudfront.net/8d73c61b-68cf-4dbd-a875-dfc44c9514fe/report.html)

@nkomonen-amazon
Copy link
Contributor

/runIntegrationTests

## Problem
In multiroot workspace setup, the contextList UI displays files that are
deduped for the same files and doesn't resolve relative paths correctly.

1. In a multi-root workspace, the index is built on the root of the 1st
project after sorting workspaceFolders, thus the chunk response also
contains relativePath to the 1st project root after sorting. In order to
get the same relativePath from explicit @file, we also need to use the
root of the 1st project after sorting workspaceFolders.
2. Use a relativePath to projectRoot map to store the project root for
each relativePath so that on clicking the file(which only returns
relativePath in the event) we correctly construct the absolute path of
the file to open in the editor.

## 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.
"required": false
},
{
"type": "cwsprChatHasContextList",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non-blocker: Are there plans to move this to the common repo? IIRC this metric was initially created here to allow you guys to move fast.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, looks like you already started a PR for this: aws/aws-toolkit-common#988

lmk if you want me to take over

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah if you take over that would be great. We have plans to consume this metric across all IDEs for some separate work.

@nkomonen-amazon nkomonen-amazon merged commit 6ff8655 into master Mar 4, 2025
32 of 34 checks passed
@nkomonen-amazon nkomonen-amazon deleted the feature/falcon branch March 4, 2025 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants