Skip to content

Commit 2d5631a

Browse files
aws-toolkit-automationnkomonen-amazonhayemaxilaileni-awsjpinkney-aws
authored
Merge master into feature/standalone (aws#4753)
* Release 2.20.0 * Update version to snapshot version: 2.21.0-SNAPSHOT * amazonq: vscode walkthrough (aws#4739) - Creates the Amazon Q walkthrough - GIFs still need to be created, we are waiting on those but we can merge for now - When the user logs in to Amazon Q the first time they will be shown the walkthrough page. It will never show again - We have telemetry for when the walkthrough is shown through our "first login" automation, and when certain events are triggered in the walkthrough such as opening the chat Signed-off-by: Nikolas Komonen <[email protected]> * fix(globals): use 'local' globals if not running web mode (aws#4754) Problem: To get web tests working we used globalThis for globals. This is shared across extensions in VS Code, resulting in problems if another extension declares the same global twice. This is occurs when we run standalone and toolkit at the same time. Solution: Use local globals if we are not in web mode. Otherwise, use full globals. This allows the web tests to pass. We will have to revisit this if we have 2 extensions running in web mode. - Also add slightly more informative globals error handling. - Refactor CW class so that globals doesn't get called during imports. * Release 0.12.0 * Update version to snapshot version: 0.13.0-SNAPSHOT * Release 0.13.0 * Update version to snapshot version: 0.14.0-SNAPSHOT * Release 0.14.0 * Update version to snapshot version: 0.15.0-SNAPSHOT * telemetry(amazonq chat): params for Q chat aws#4714 Problem: - Missing parameters in `onCopyCodeToClipboard` and `onCodeInsertToCursorPosition` events for telemetry. Solution: - Added `cwsprChatCodeBlockIndex` and `cwsprChatTotalCodeBlocks` parameters to the `onCopyCodeToClipboard` and `onCodeInsertToCursorPosition` events. - `cwsprChatCodeBlockIndex` - Provides the index of that code block, when a user interacts with a code block within a message in the conversation, - `cwsprChatTotalCodeBlocks` - Total number of code blocks inside a generated message. - Passed these two parameters to `insert_code_at_cursor_position` and `code_was_copied_to_clipboard` telemetry events. * feat: beautify auth page after pkce login (aws#4738) * feat: beautify auth page after pkce login Problem: - Old screen was ugly and basic Solution: - New screen is similiar to the current oidc login webpage NOTE: We need to manually copy the html to dist because the vue loader doesn't do it for us. Also, it's a lot simpler to just serve the html rather than do server side loading for the vue component * amazonq: command to show the chat window (aws#4756) Before, we had a function to show the chat webview or used the vscode generated show chat command. Now we have a single command which can be used anywhere. This will allow us to get better metrics on when the chat window is opened. Signed-off-by: Nikolas Komonen <[email protected]> * test: fik flaky fs test (aws#4764) Our mkdir() spy was sometimes catching an unexpected mkdir() call and causing the test to fail. So instead we are just checking that the first mkdir() call has the expected args Signed-off-by: Nikolas Komonen <[email protected]> * fix(amazonq): remove Welcome Page aws#4736 Remove onboarding page in favor of walkthrough aws#4739 * feat(amazonq): marketplace icon aws#4767 Update Q icon. This png is currently only used for the marketplace listing. --------- Signed-off-by: Nikolas Komonen <[email protected]> Co-authored-by: aws-toolkit-automation <> Co-authored-by: Nikolas Komonen <[email protected]> Co-authored-by: Maxim Hayes <[email protected]> Co-authored-by: Laxman Reddy <[email protected]> Co-authored-by: Josh Pinkney <[email protected]> Co-authored-by: Vikash Agrawal <[email protected]> Co-authored-by: Justin M. Keyes <[email protected]> Co-authored-by: Nikolas Komonen <[email protected]>
1 parent be0e1a0 commit 2d5631a

File tree

18 files changed

+407
-39
lines changed

18 files changed

+407
-39
lines changed

.changes/2.20.0.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"date": "2024-04-19",
3+
"version": "2.20.0",
4+
"entries": [
5+
{
6+
"type": "Bug Fix",
7+
"description": "Amazon Q CodeTransform may fail if JAVA_HOME has leading or trailing whitespace"
8+
},
9+
{
10+
"type": "Bug Fix",
11+
"description": "Amazon Q FeatureDev: code generation may fail with \"conversation id not found\" error"
12+
},
13+
{
14+
"type": "Bug Fix",
15+
"description": "Amazon Q Code Transformation: show error messages in chat"
16+
},
17+
{
18+
"type": "Bug Fix",
19+
"description": "Amazon Q Code Transformation - Omit Maven metadata files when uploading dependencies to fix certain build failures in backend."
20+
},
21+
{
22+
"type": "Feature",
23+
"description": "Enable Amazon Q feature development and Amazon Q transform capabilities (/dev and /transform) for AWS Builder ID users."
24+
}
25+
]
26+
}

.changes/next-release/Bug Fix-2ed5285f-e19a-415f-8f7e-64126fafa784.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

package-lock.json

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

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3966,7 +3966,7 @@
39663966
"@aws-sdk/property-provider": "3.46.0",
39673967
"@aws-sdk/smithy-client": "^3.46.0",
39683968
"@aws-sdk/util-arn-parser": "^3.46.0",
3969-
"@aws/mynah-ui": "^4.5.5",
3969+
"@aws/mynah-ui": "^4.5.6",
39703970
"@gerhobbelt/gitignore-parser": "^0.2.0-9",
39713971
"@iarna/toml": "^2.2.5",
39723972
"@smithy/shared-ini-file-loader": "^2.2.8",

packages/core/src/amazonq/activation.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { activateBadge } from './util/viewBadgeHandler'
1515
import { amazonQHelpUrl } from '../shared/constants'
1616
import { openAmazonQWalkthrough } from './onboardingPage/walkthrough'
1717
import { listCodeWhispererCommandsWalkthrough } from '../codewhisperer/ui/statusBarMenu'
18+
import { focusAmazonQPanel } from '../codewhispererChat/commands/registerCommands'
1819

1920
export async function activate(context: ExtensionContext) {
2021
const appInitContext = DefaultAmazonQAppInitContext.instance
@@ -36,7 +37,8 @@ export async function activate(context: ExtensionContext) {
3637
}),
3738
focusAmazonQChatWalkthrough.register(),
3839
openAmazonQWalkthrough.register(),
39-
listCodeWhispererCommandsWalkthrough.register()
40+
listCodeWhispererCommandsWalkthrough.register(),
41+
focusAmazonQPanel.register()
4042
)
4143

4244
Commands.register('aws.amazonq.learnMore', () => {
Lines changed: 245 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,245 @@
1+
/*!
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
import * as vscode from 'vscode'
7+
import globals from '../../shared/extensionGlobals'
8+
import path from 'path'
9+
import { MessagePublisher } from '../messages/messagePublisher'
10+
import { telemetry } from '../../shared/telemetry/telemetry'
11+
import { getLogger } from '../../shared/logger'
12+
import { placeholder } from '../../shared/vscode/commands2'
13+
import { focusAmazonQPanel } from '../../codewhispererChat/commands/registerCommands'
14+
15+
export function welcome(context: vscode.ExtensionContext, cwcWebViewToAppsPublisher: MessagePublisher<any>): void {
16+
const panel = vscode.window.createWebviewPanel(
17+
'amazonQWelcome',
18+
'Meet Amazon Q (Preview)',
19+
vscode.ViewColumn.Active,
20+
{
21+
enableScripts: true,
22+
}
23+
)
24+
25+
// TODO: get svg gradient icon and use `getIcon` (currently only works with svg)
26+
panel.iconPath = vscode.Uri.file(
27+
globals.context.asAbsolutePath(path.join('resources', 'icons', 'aws', 'amazonq', 'q-gradient.svg'))
28+
)
29+
30+
panel.webview.html = getWebviewContent(panel.webview)
31+
32+
// Handle messages from the webview
33+
panel.webview.onDidReceiveMessage(
34+
message => {
35+
telemetry.ui_click.run(() => {
36+
switch (message.command) {
37+
case 'sendToQ':
38+
telemetry.record({ elementId: 'amazonq_meet_askq' })
39+
focusAmazonQPanel.execute(placeholder, 'sendToQ').then(
40+
() => {
41+
cwcWebViewToAppsPublisher.publish({
42+
type: 'onboarding-page-cwc-button-clicked',
43+
command: 'onboarding-page-interaction',
44+
})
45+
},
46+
e => {
47+
getLogger().error('focusAmazonQPanel failed: %s', (e as Error).message)
48+
}
49+
)
50+
51+
return
52+
53+
case 'goToHelp':
54+
telemetry.record({ elementId: 'amazonq_tryExamples' })
55+
void vscode.commands.executeCommand('aws.codeWhisperer.gettingStarted')
56+
return
57+
}
58+
})
59+
},
60+
undefined,
61+
context.subscriptions
62+
)
63+
64+
// user closes webview
65+
// does this fire on IDE shutdown?
66+
panel.onDidDispose(() => {
67+
telemetry.ui_click.emit({
68+
elementId: 'amazonq_closeWebview',
69+
passive: true,
70+
})
71+
})
72+
}
73+
74+
function getWebviewContent(webview: vscode.Webview): string {
75+
const logo = webview.asWebviewUri(
76+
vscode.Uri.file(
77+
globals.context.asAbsolutePath(path.join('resources', 'icons', 'aws', 'amazonq', 'q-gradient.svg'))
78+
)
79+
)
80+
const bgLogoLight = webview.asWebviewUri(
81+
vscode.Uri.file(
82+
globals.context.asAbsolutePath(path.join('resources', 'icons', 'aws', 'amazonq', 'q-squid-ink.svg'))
83+
)
84+
)
85+
const bgLogoDark = webview.asWebviewUri(
86+
vscode.Uri.file(
87+
globals.context.asAbsolutePath(path.join('resources', 'icons', 'aws', 'amazonq', 'q-white.svg'))
88+
)
89+
)
90+
const cwLogoLight = webview.asWebviewUri(
91+
vscode.Uri.file(
92+
globals.context.asAbsolutePath(path.join('resources', 'icons', 'aws', 'codewhisperer', 'icon-black.svg'))
93+
)
94+
)
95+
const cwLogoDark = webview.asWebviewUri(
96+
vscode.Uri.file(
97+
globals.context.asAbsolutePath(path.join('resources', 'icons', 'aws', 'codewhisperer', 'icon-white.svg'))
98+
)
99+
)
100+
return `
101+
<!DOCTYPE html>
102+
<html lang="en">
103+
<head>
104+
<meta charset="UTF-8">
105+
<meta http-equiv="Content-Security-Policy"
106+
content="default-src 'none';
107+
font-src ${webview.cspSource};
108+
script-src 'self' 'unsafe-inline';
109+
style-src 'self' 'unsafe-inline' ${webview.cspSource};
110+
img-src ${webview.cspSource}"
111+
>
112+
<meta name="viewport" content="width=device-width, initial-scale=1">
113+
<style>
114+
body.vscode-light #bg {
115+
content: url(${bgLogoLight});
116+
opacity: 0.05;
117+
}
118+
body.vscode-dark #bg {
119+
content: url(${bgLogoDark});
120+
opacity: 0.05;
121+
}
122+
body.vscode-light #codewhispererLogo {
123+
content: url(${cwLogoLight})
124+
}
125+
body.vscode-dark #codewhispererLogo {
126+
content: url(${cwLogoDark})
127+
}
128+
body {
129+
height: 100vh;
130+
}
131+
#bg {
132+
position: fixed;
133+
left: 70%;
134+
top: -10%;
135+
overflow: hidden;
136+
transform: scale(2);
137+
pointer-events:none;
138+
user-select: none;
139+
}
140+
#sendToQButton {
141+
background: linear-gradient(14deg, rgba(52,20,120,1) 0%, rgba(91,41,196,1) 25%, rgba(117,55,247,1) 50%, rgba(73,125,254,1) 75%, rgba(170,233,255,1) 100%);
142+
color: white;
143+
border-radius: 6px;
144+
border: none;
145+
font-size: 20px;
146+
padding: 0.5em 1em;
147+
text-align: center;
148+
cursor: pointer;
149+
}
150+
#wrapper {
151+
height: 100%;
152+
width: 100%;
153+
min-width: 600px;
154+
overflow-y: auto;
155+
overflow-x: auto;
156+
display: flex;
157+
flex-direction: row;
158+
justify-content: center;
159+
align-items: center;
160+
}
161+
#content {
162+
max-width: 550px;
163+
padding: 30px;
164+
display: flex;
165+
flex-direction: column;
166+
gap: 30px;
167+
align-items: center;
168+
}
169+
#codewhisperer {
170+
display: flex;
171+
align-items: center;
172+
flex-direction: row;
173+
gap: 40px;
174+
flex-wrap: nowrap;
175+
}
176+
#codewhisperer div p {
177+
margin: 0px;
178+
font-size: 12pt;
179+
}
180+
#qLogo {
181+
width: 70px
182+
}
183+
#imageContainer {
184+
width: 40px;
185+
height: auto;
186+
flex-shrink: 0;
187+
flex-grow: 0;
188+
}
189+
#textWrapper {
190+
flex-shrink: 1;
191+
flex-grow: 1;
192+
}
193+
#header {
194+
text-align: center;
195+
margin: 0;
196+
}
197+
a {
198+
cursor: pointer;
199+
}
200+
.spacingrow {
201+
display: flex;
202+
flex-direction: row;
203+
gap: 40px;
204+
flex-wrap: nowrap;
205+
}
206+
</style>
207+
</head>
208+
<body>
209+
<img id="bg">
210+
<div id="wrapper">
211+
<div id="content">
212+
<img id="qLogo" src="${logo}"/>
213+
<h1 id="header">Hello! I'm Amazon Q, your generative AI assistant.</h1>
214+
<div id="buttonContainer">
215+
<button id="sendToQButton">Ask a question</button>
216+
</div>
217+
<!-- spacing -->
218+
<div class="spacingrow"> </div>
219+
<div class="spacingrow"> </div>
220+
<!-- end spacing -->
221+
<div id="codewhisperer">
222+
<div id="imageContainer">
223+
<img id="codewhispererLogo"/>
224+
</div>
225+
<div id="textWrapper">
226+
<p>CodeWhisperer inline suggestions are also enabled.<br><a id="goToHelpLink">Try examples</a></p>
227+
</div>
228+
</div>
229+
</div>
230+
</div>
231+
<script>
232+
(function() {
233+
const vscode = acquireVsCodeApi()
234+
const sendToQ = () => { vscode.postMessage({ command: "sendToQ" }) }
235+
const goToHelp = () => { vscode.postMessage({ command: "goToHelp" }) }
236+
const sendToQButton = document.getElementById('sendToQButton')
237+
sendToQButton.onclick = sendToQ
238+
const goToHelpLink = document.getElementById('goToHelpLink')
239+
goToHelpLink.onclick = goToHelp
240+
}())
241+
</script>
242+
</body>
243+
</html>
244+
`
245+
}

packages/core/src/amazonq/webview/ui/apps/cwChatConnector.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,10 @@ export class Connector {
9292
messageId: string,
9393
code?: string,
9494
type?: 'selection' | 'block',
95-
codeReference?: CodeReference[]
95+
codeReference?: CodeReference[],
96+
eventId?: string,
97+
codeBlockIndex?: number,
98+
totalCodeBlocks?: number
9699
): void => {
97100
this.sendMessageToExtension({
98101
tabID: tabID,
@@ -102,6 +105,9 @@ export class Connector {
102105
tabType: 'cwc',
103106
insertionTargetType: type,
104107
codeReference,
108+
eventId,
109+
codeBlockIndex,
110+
totalCodeBlocks,
105111
})
106112
}
107113

@@ -110,7 +116,10 @@ export class Connector {
110116
messageId: string,
111117
code?: string,
112118
type?: 'selection' | 'block',
113-
codeReference?: CodeReference[]
119+
codeReference?: CodeReference[],
120+
eventId?: string,
121+
codeBlockIndex?: number,
122+
totalCodeBlocks?: number
114123
): void => {
115124
this.sendMessageToExtension({
116125
tabID: tabID,
@@ -120,6 +129,9 @@ export class Connector {
120129
tabType: 'cwc',
121130
insertionTargetType: type,
122131
codeReference,
132+
eventId,
133+
codeBlockIndex,
134+
totalCodeBlocks,
123135
})
124136
}
125137

0 commit comments

Comments
 (0)