Skip to content

Commit 457efa4

Browse files
authored
Merge pull request aws#7210 from aws/feature/hybridChat
feat(agentic chat): Agentic coding experience: Amazon Q can now write code and run shell commands on your behalf
2 parents 0651afd + 1dff099 commit 457efa4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+2139
-1475
lines changed

docs/lsp.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ sequenceDiagram
2626

2727
## Language Server Debugging
2828

29-
1. Clone https://github.com/aws/language-servers.git and set it up in the same workspace as this project
29+
1. Clone https://github.com/aws/language-servers.git and set it up in the same workspace as this project by cmd+shift+p and "add folder to workspace" and selecting the language-servers folder that you just cloned. Your VS code folder structure should look like below.
3030

31-
e.g.
31+
3232

3333
```
3434
/aws-toolkit-vscode
@@ -53,9 +53,9 @@ sequenceDiagram
5353
"amazonqLSPChat": true // optional: enables chat from flare
5454
}
5555
```
56-
4. Uncomment the `__AMAZONQLSP_PATH` variable in `amazonq/.vscode/launch.json` Extension configuration
57-
1. Uncomment the `__AMAZONQLSP_UI` variable in `amazonq/.vscode/launch.json` Extension configuration if you want to debug the flare chat-client as well
56+
4. Uncomment the `__AMAZONQLSP_PATH` and `__AMAZONQLSP_UI` variables in the `amazonq/.vscode/launch.json` extension configuration
5857
5. Use the `Launch LSP with Debugging` configuration and set breakpoints in VSCode or the language server
58+
6. (Optional): Enable `"amazonq.trace.server": "on"` or `"amazonq.trace.server": "verbose"` in your VSCode settings to view detailed log messages sent to/from the language server. These log messages will show up in the "Amazon Q Language Server" output channel
5959
6060
## Amazon Q Inline Activation
6161

package-lock.json

Lines changed: 510 additions & 1010 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"skippedTestReport": "ts-node ./scripts/skippedTestReport.ts ./packages/amazonq/test/e2e/"
4242
},
4343
"devDependencies": {
44-
"@aws-toolkits/telemetry": "^1.0.312",
44+
"@aws-toolkits/telemetry": "^1.0.317",
4545
"@playwright/browser-chromium": "^1.43.1",
4646
"@stylistic/eslint-plugin": "^2.11.0",
4747
"@types/he": "^1.2.3",
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Feature",
3+
"description": "Agentic coding experience: Amazon Q can now write code and run shell commands on your behalf"
4+
}

packages/amazonq/.vscode/launch.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"env": {
1515
"SSMDOCUMENT_LANGUAGESERVER_PORT": "6010",
1616
"WEBPACK_DEVELOPER_SERVER": "http://localhost:8080"
17-
// "__AMAZONQLSP_PATH": "${workspaceFolder}/../../../language-servers/app/aws-lsp-codewhisperer-runtimes/out/token-standalone.js",
17+
// Below allows for overrides used during development
18+
// "__AMAZONQLSP_PATH": "${workspaceFolder}/../../../language-servers/app/aws-lsp-codewhisperer-runtimes/out/agent-standalone.js",
1819
// "__AMAZONQLSP_UI": "${workspaceFolder}/../../../language-servers/chat-client/build/amazonq-ui.js"
1920
},
2021
"envFile": "${workspaceFolder}/.local.env",

packages/amazonq/package.json

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@
132132
"type": "boolean",
133133
"default": false
134134
},
135+
"amazonQChatPairProgramming": {
136+
"type": "boolean",
137+
"default": false
138+
},
135139
"amazonQSelectDeveloperProfile": {
136140
"type": "boolean",
137141
"default": false
@@ -181,7 +185,25 @@
181185
"amazonQ.workspaceIndexMaxSize": {
182186
"type": "number",
183187
"markdownDescription": "%AWS.configuration.description.amazonq.workspaceIndexMaxSize%",
184-
"default": 250,
188+
"default": 2048,
189+
"scope": "application"
190+
},
191+
"amazonQ.workspaceIndexMaxFileSize": {
192+
"type": "number",
193+
"markdownDescription": "%AWS.configuration.description.amazonq.workspaceIndexMaxFileSize%",
194+
"default": 10,
195+
"scope": "application"
196+
},
197+
"amazonQ.workspaceIndexCacheDirPath": {
198+
"type": "string",
199+
"markdownDescription": "%AWS.configuration.description.amazonq.workspaceIndexCacheDirPath%",
200+
"default": null,
201+
"scope": "application"
202+
},
203+
"amazonQ.workspaceIndexIgnoreFilePatterns": {
204+
"type": "array",
205+
"markdownDescription": "%AWS.configuration.description.amazonq.workspaceIndexIgnoreFilePatterns%",
206+
"default": [],
185207
"scope": "application"
186208
},
187209
"amazonQ.ignoredSecurityIssues": {

packages/amazonq/src/app/chat/activation.ts

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,56 +4,33 @@
44
*/
55

66
import * as vscode from 'vscode'
7-
import { ExtensionContext, window } from 'vscode'
7+
import { ExtensionContext } from 'vscode'
88
import { telemetry } from 'aws-core-vscode/telemetry'
99
import { AuthUtil, CodeWhispererSettings } from 'aws-core-vscode/codewhisperer'
1010
import { Commands, placeholder, funcUtil } from 'aws-core-vscode/shared'
1111
import * as amazonq from 'aws-core-vscode/amazonq'
12-
import { scanChatAppInit } from '../amazonqScan'
1312

1413
export async function activate(context: ExtensionContext) {
1514
const appInitContext = amazonq.DefaultAmazonQAppInitContext.instance
16-
17-
registerApps(appInitContext, context)
18-
19-
const provider = new amazonq.AmazonQChatViewProvider(
20-
context,
21-
appInitContext.getWebViewToAppsMessagePublishers(),
22-
appInitContext.getAppsToWebViewMessageListener(),
23-
appInitContext.onDidChangeAmazonQVisibility
24-
)
25-
2615
await amazonq.TryChatCodeLensProvider.register(appInitContext.onDidChangeAmazonQVisibility.event)
2716

2817
const setupLsp = funcUtil.debounce(async () => {
2918
void amazonq.LspController.instance.trySetupLsp(context, {
3019
startUrl: AuthUtil.instance.startUrl,
3120
maxIndexSize: CodeWhispererSettings.instance.getMaxIndexSize(),
32-
isVectorIndexEnabled: CodeWhispererSettings.instance.isLocalIndexEnabled(),
21+
isVectorIndexEnabled: false,
3322
})
3423
}, 5000)
3524

3625
context.subscriptions.push(
37-
window.registerWebviewViewProvider(amazonq.AmazonQChatViewProvider.viewType, provider, {
38-
webviewOptions: {
39-
retainContextWhenHidden: true,
40-
},
41-
}),
4226
amazonq.focusAmazonQChatWalkthrough.register(),
4327
amazonq.walkthroughInlineSuggestionsExample.register(),
4428
amazonq.walkthroughSecurityScanExample.register(),
4529
amazonq.openAmazonQWalkthrough.register(),
4630
amazonq.listCodeWhispererCommandsWalkthrough.register(),
4731
amazonq.focusAmazonQPanel.register(),
4832
amazonq.focusAmazonQPanelKeybinding.register(),
49-
amazonq.tryChatCodeLensCommand.register(),
50-
vscode.workspace.onDidChangeConfiguration(async (configurationChangeEvent) => {
51-
if (configurationChangeEvent.affectsConfiguration('amazonQ.workspaceIndex')) {
52-
if (CodeWhispererSettings.instance.isLocalIndexEnabled()) {
53-
void setupLsp()
54-
}
55-
}
56-
})
33+
amazonq.tryChatCodeLensCommand.register()
5734
)
5835

5936
Commands.register('aws.amazonq.learnMore', () => {
@@ -64,15 +41,6 @@ export async function activate(context: ExtensionContext) {
6441
void setupAuthNotification()
6542
}
6643

67-
function registerApps(appInitContext: amazonq.AmazonQAppInitContext, context: ExtensionContext) {
68-
amazonq.cwChatAppInit(appInitContext)
69-
amazonq.featureDevChatAppInit(appInitContext)
70-
amazonq.gumbyChatAppInit(appInitContext)
71-
amazonq.testChatAppInit(appInitContext)
72-
scanChatAppInit(appInitContext)
73-
amazonq.docChatAppInit(appInitContext)
74-
}
75-
7644
/**
7745
* Display a notification to user for Log In.
7846
*
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*!
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
import * as amazonqNode from 'aws-core-vscode/amazonq/node'
7+
import { scanChatAppInit } from '../../amazonqScan'
8+
import { DefaultAmazonQAppInitContext } from 'aws-core-vscode/amazonq'
9+
10+
export function activateAgents() {
11+
const appInitContext = DefaultAmazonQAppInitContext.instance
12+
13+
amazonqNode.cwChatAppInit(appInitContext)
14+
amazonqNode.featureDevChatAppInit(appInitContext)
15+
amazonqNode.gumbyChatAppInit(appInitContext)
16+
amazonqNode.testChatAppInit(appInitContext)
17+
amazonqNode.docChatAppInit(appInitContext)
18+
scanChatAppInit(appInitContext)
19+
}

packages/amazonq/src/extension.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export async function activateAmazonQCommon(context: vscode.ExtensionContext, is
121121
// This contains every lsp agnostic things (auth, security scan, code scan)
122122
await activateCodeWhisperer(extContext as ExtContext)
123123
if (
124-
(Experiments.instance.get('amazonqLSP', false) || Auth.instance.isInternalAmazonUser()) &&
124+
(Experiments.instance.get('amazonqLSP', true) || Auth.instance.isInternalAmazonUser()) &&
125125
!isAmazonInternalOs()
126126
) {
127127
// start the Amazon Q LSP for internal users first

packages/amazonq/src/extensionNode.ts

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
import * as vscode from 'vscode'
77
import { activateAmazonQCommon, amazonQContextPrefix, deactivateCommon } from './extension'
8-
import { DefaultAmazonQAppInitContext } from 'aws-core-vscode/amazonq'
9-
import { activate as activateQGumby } from 'aws-core-vscode/amazonqGumby'
8+
import { DefaultAmazonQAppInitContext, AmazonQChatViewProvider } from 'aws-core-vscode/amazonq'
9+
import { activate as activateTransformationHub } from 'aws-core-vscode/amazonqGumby'
1010
import {
1111
ExtContext,
1212
globals,
@@ -30,6 +30,7 @@ import { beta } from 'aws-core-vscode/dev'
3030
import { activate as activateNotifications, NotificationsController } from 'aws-core-vscode/notifications'
3131
import { AuthState, AuthUtil } from 'aws-core-vscode/codewhisperer'
3232
import { telemetry, AuthUserState } from 'aws-core-vscode/telemetry'
33+
import { activateAgents } from './app/chat/node/activateAgents'
3334

3435
export async function activate(context: vscode.ExtensionContext) {
3536
// IMPORTANT: No other code should be added to this function. Place it in one of the following 2 functions where appropriate.
@@ -52,10 +53,26 @@ async function activateAmazonQNode(context: vscode.ExtensionContext) {
5253
extensionContext: context,
5354
}
5455

55-
if (!Experiments.instance.get('amazonqChatLSP', false)) {
56+
if (!Experiments.instance.get('amazonqChatLSP', true)) {
57+
const appInitContext = DefaultAmazonQAppInitContext.instance
58+
const provider = new AmazonQChatViewProvider(
59+
context,
60+
appInitContext.getWebViewToAppsMessagePublishers(),
61+
appInitContext.getAppsToWebViewMessageListener(),
62+
appInitContext.onDidChangeAmazonQVisibility
63+
)
64+
context.subscriptions.push(
65+
vscode.window.registerWebviewViewProvider(AmazonQChatViewProvider.viewType, provider, {
66+
webviewOptions: {
67+
retainContextWhenHidden: true,
68+
},
69+
})
70+
)
71+
// this is registered inside of lsp/chat/activation.ts when the chat experiment is enabled
5672
await activateCWChat(context)
57-
await activateQGumby(extContext as ExtContext)
5873
}
74+
activateAgents()
75+
await activateTransformationHub(extContext as ExtContext)
5976
activateInlineChat(context)
6077

6178
const authProvider = new CommonAuthViewProvider(

0 commit comments

Comments
 (0)