-
Notifications
You must be signed in to change notification settings - Fork 737
feat(amazonq): Chat Project Context With LSP #5271
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
Merged
Merged
Changes from 105 commits
Commits
Show all changes
113 commits
Select commit
Hold shift + click to select a range
3e77bb6
poc
leigaol 838cda1
POC
leigaol c307783
append prompt
leigaol f9c96c2
onnx
leigaol 29a484d
fix prompt
leigaol 599e5bf
add
leigaol d40e8e2
efficient index
leigaol 80437ae
add pl check; add net install
leigaol ded9234
# design
leigaol e19b9f6
reload post install
leigaol c0d57c2
trying lsp
leigaol dddf8c4
lsp server
leigaol 4cc815b
lsp
leigaol f6ecf1c
update lsp server
leigaol ae8b534
merge master
leigaol 2ded01a
@prj
leigaol 087ea0f
@ws; add settings
leigaol 8ede30a
telemetry
leigaol 87927c3
fix conflict
leigaol 74825de
flip settings
leigaol 6c6dc5a
add more support file types
leigaol b354ea1
open settings
leigaol 8c0692b
file filter
leigaol 54f86a3
add unzip
leigaol 036fc06
disable download
leigaol b684ffd
add more supported file
leigaol 41e0d91
interact telemetry;did close
leigaol 3e6eba9
199 version; update trigger
leigaol 7ccf87e
add space and \n
leigaol f867472
1.9.10
leigaol eea6675
local zip install
leigaol ba8171c
top N
leigaol bf6cae4
add telemetry API model change
leigaol 93c4dd1
add hasProjectLevelContext
leigaol 824d262
merge with staging
leigaol 206eac2
remove @ws
leigaol 8b8f81c
add lang translation
leigaol 95f3282
rename
leigaol 55611b5
lsp controller
leigaol 3c63e9e
download login
leigaol 98e6d0d
merge staging
leigaol f3db2cc
min changes
leigaol ae71c4e
refactor
leigaol 2e12799
minimize changes
leigaol 634edac
sha match
leigaol 1828f1a
gamma
leigaol 5542aa4
update download mechanism
leigaol f85e6e0
defaut false
leigaol 570a474
default false
leigaol 6be7812
update
leigaol 28f373e
update
leigaol fc0d6a0
fix cyclic dep
leigaol 45782bd
telemetry;stdin
leigaol ab59b0a
encryption of LSP
leigaol 330f2ee
Merge branch 'staging' of github.com:leigaol/aws-toolkit-vscode-stagi…
leigaol 66d36fd
add comments
leigaol 01e9e23
update
leigaol 96fed7b
turn on msg prompt
leigaol 50636f4
cpu metrics
leigaol 87421ce
update version
leigaol 7ea20b4
settings
leigaol 029c251
fix conflict
leigaol bcfeb40
1.11.4
leigaol 1e72326
open settings
leigaol a4beebf
env path
leigaol baedce5
also download node runtime
leigaol 3dc0a76
description update
leigaol a89a46e
promote version
leigaol 8d49dde
str
leigaol ef4c883
fix node name in windows
leigaol 2766c6a
node bin name
leigaol 2521bbe
merge
leigaol aa33fac
try catch
leigaol d1f52cd
pkg json
leigaol 76175ff
update
leigaol f992b49
GPU
leigaol 2198637
simplify env var passing
leigaol fb13b70
fix index memory metrics
leigaol d35adf6
ignore more files
leigaol 88794c0
add credentialStartUrl to amazonq_indexWorkspace
leigaol b8223ea
use lsp 0.0.6
leigaol 3de26f3
add LSP download hash unit test
leigaol 74f2b71
add more test cases
leigaol 9647432
merge staging
leigaol a71a446
fix workspace in the middle bug; fix lsp slow start query bug
leigaol f52a37e
gpu default false
leigaol e5e9ce1
fix accidental regression of lsp not starting
leigaol b27a234
format code
leigaol 902beea
0.0.8 lsp
leigaol 915817d
0.0.9 lsp
leigaol d5082af
lsp 0.1.0
leigaol accdbaa
merge mainline
leigaol fd09a18
add max index size; add debug log for printing which file is used
leigaol 92d32dd
misc
leigaol 6e3311b
remove console.log
leigaol cdd1a70
add ux for query during indexing
leigaol 5065a60
resolve comments
leigaol ad183a7
Merge branch 'master' of github.com:leigaol/aws-toolkit-vscode into p…
leigaol 2fd4784
fix unit test
leigaol 62aaa2b
resolve feedback
leigaol 476b3f7
lint
leigaol 9a0b8fb
more doc string
leigaol f712f8f
move indexing in progress message inside Q response
leigaol fdd674d
Merge branch 'master' of github.com:leigaol/aws-toolkit-vscode into p…
leigaol 71fd65a
fix test cases
leigaol d792a5f
address some feedback
leigaol a7733f3
resolve some feedback
leigaol adda9e2
resolve other feedback
leigaol 194fe25
renamed to workspace index
leigaol 852a879
update change log
leigaol f8290e0
more robust download, avoid mv file when file already exists; use req…
leigaol 6552e78
use new manifest url
leigaol 5859e32
Merge branch 'master' of github.com:leigaol/aws-toolkit-vscode into p…
leigaol File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
4 changes: 4 additions & 0 deletions
4
packages/amazonq/.changes/next-release/Feature-69f0d3bf-3e57-4ad6-93ea-48de3c890331.json
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "type": "Feature", | ||
| "description": "Add LSP for Amazon Q Chat Local Indexing. Customers can use @workspace to ask questions regarding local workspace." | ||
| } |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| import * as sinon from 'sinon' | ||
| import assert from 'assert' | ||
| import { globals } from 'aws-core-vscode/shared' | ||
| import { LspClient } from 'aws-core-vscode/amazonq' | ||
|
|
||
| describe('Amazon Q LSP client', function () { | ||
| let lspClient: LspClient | ||
| let encryptFunc: sinon.SinonSpy | ||
|
|
||
| beforeEach(async function () { | ||
| sinon.stub(globals, 'isWeb').returns(false) | ||
| lspClient = new LspClient() | ||
| encryptFunc = sinon.spy(lspClient, 'encrypt') | ||
| }) | ||
|
|
||
| it('encrypts payload of query ', async () => { | ||
| await lspClient.query('mock_input') | ||
| assert.ok(encryptFunc.calledOnce) | ||
| assert.ok(encryptFunc.calledWith(JSON.stringify({ query: 'mock_input' }))) | ||
leigaol marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| const value = await encryptFunc.returnValues[0] | ||
| // verifies JWT encryption header | ||
| assert.ok(value.startsWith(`eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIn0`)) | ||
| }) | ||
|
|
||
| it('encrypts payload of index files ', async () => { | ||
| await lspClient.indexFiles(['fileA'], 'path', false) | ||
| assert.ok(encryptFunc.calledOnce) | ||
| assert.ok( | ||
| encryptFunc.calledWith( | ||
| JSON.stringify({ | ||
| filePaths: ['fileA'], | ||
| rootPath: 'path', | ||
| refresh: false, | ||
| }) | ||
| ) | ||
| ) | ||
| const value = await encryptFunc.returnValues[0] | ||
| // verifies JWT encryption header | ||
| assert.ok(value.startsWith(`eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIn0`)) | ||
| }) | ||
|
|
||
| it('encrypt removes readable information', async () => { | ||
| const sample = 'hello' | ||
| const encryptedSample = await lspClient.encrypt(sample) | ||
| assert.ok(!encryptedSample.includes('hello')) | ||
| }) | ||
|
|
||
| afterEach(() => { | ||
| sinon.restore() | ||
| }) | ||
| }) | ||
51 changes: 51 additions & 0 deletions
51
packages/amazonq/test/unit/amazonq/lsp/lspController.test.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| /*! | ||
| * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
| import assert from 'assert' | ||
| import sinon from 'sinon' | ||
| import { Content, LspController } from 'aws-core-vscode/amazonq' | ||
| import { createTestFile } from 'aws-core-vscode/test' | ||
| import { fs } from 'aws-core-vscode/shared' | ||
|
|
||
| describe('Test LSP controller', function () { | ||
leigaol marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| it('Downloaded mechanism checks against hash, when hash matches', async function () { | ||
leigaol marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| const content = { | ||
| filename: 'qserver-linux-x64.zip', | ||
| url: 'https://x/0.0.6/qserver-linux-x64.zip', | ||
| hashes: [ | ||
| 'sha384:768412320f7b0aa5812fce428dc4706b3cae50e02a64caa16a782249bfe8efc4b7ef1ccb126255d196047dfedf17a0a9', | ||
| ], | ||
| bytes: 512, | ||
| } as Content | ||
| const lspController = new LspController() | ||
| sinon.stub(lspController, '_download') | ||
| const mockFileName = 'test_case_1.zip' | ||
| const mockDownloadFile = await createTestFile(mockFileName) | ||
| await fs.writeFile(mockDownloadFile.fsPath, 'test') | ||
| const result = await lspController.downloadAndCheckHash(mockDownloadFile.fsPath, content) | ||
| assert.strictEqual(result, true) | ||
| }) | ||
|
|
||
| it('Verify downloaded mechanism checks against hash, when hash does not match', async function () { | ||
leigaol marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| const content = { | ||
| filename: 'qserver-linux-x64.zip', | ||
| url: 'https://x/0.0.6/qserver-linux-x64.zip', | ||
| hashes: [ | ||
| 'sha384:38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b', | ||
| ], | ||
| bytes: 512, | ||
| } as Content | ||
| const lspController = new LspController() | ||
| sinon.stub(lspController, '_download') | ||
| const mockFileName = 'test_case_2.zip' | ||
| const mockDownloadFile = await createTestFile(mockFileName) | ||
| await fs.writeFile(mockDownloadFile.fsPath, 'file_content') | ||
| const result = await lspController.downloadAndCheckHash(mockDownloadFile.fsPath, content) | ||
| assert.strictEqual(result, false) | ||
| }) | ||
|
|
||
| afterEach(() => { | ||
| sinon.restore() | ||
| }) | ||
| }) | ||
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.