Skip to content

Commit 060b779

Browse files
authored
Merge branch 'master' into fix-deeplink-reconnect
2 parents b458efa + aa4335c commit 060b779

File tree

100 files changed

+10096
-551
lines changed

Some content is hidden

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

100 files changed

+10096
-551
lines changed

package-lock.json

Lines changed: 6 additions & 6 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
@@ -74,7 +74,7 @@
7474
"webpack-merge": "^5.10.0"
7575
},
7676
"dependencies": {
77-
"@aws/language-server-runtimes": "^0.2.125",
77+
"@aws/language-server-runtimes": "^0.2.128",
7878
"@types/node": "^22.7.5",
7979
"jaro-winkler": "^0.2.8",
8080
"vscode-nls": "^5.2.0",
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"date": "2025-09-11",
3+
"version": "1.94.0",
4+
"entries": []
5+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"date": "2025-09-19",
3+
"version": "1.95.0",
4+
"entries": [
5+
{
6+
"type": "Bug Fix",
7+
"description": "Amazon Q automatically refreshes expired IAM Credentials in Sagemaker instances"
8+
}
9+
]
10+
}

packages/amazonq/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## 1.95.0 2025-09-19
2+
3+
- **Bug Fix** Amazon Q automatically refreshes expired IAM Credentials in Sagemaker instances
4+
5+
## 1.94.0 2025-09-11
6+
7+
- Miscellaneous non-user-facing changes
8+
19
## 1.93.0 2025-09-05
210

311
- Miscellaneous non-user-facing changes

packages/amazonq/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "amazon-q-vscode",
33
"displayName": "Amazon Q",
44
"description": "The most capable generative AI–powered assistant for software development.",
5-
"version": "1.94.0-SNAPSHOT",
5+
"version": "1.96.0-SNAPSHOT",
66
"extensionKind": [
77
"workspace"
88
],

packages/amazonq/src/app/amazonqScan/app.ts

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,14 @@
44
*/
55

66
import * as vscode from 'vscode'
7-
import {
8-
AmazonQAppInitContext,
9-
MessagePublisher,
10-
MessageListener,
11-
focusAmazonQPanel,
12-
DefaultAmazonQAppInitContext,
13-
} from 'aws-core-vscode/amazonq'
7+
import { AmazonQAppInitContext, MessageListener } from 'aws-core-vscode/amazonq'
148
import { AuthUtil, codeScanState, onDemandFileScanState } from 'aws-core-vscode/codewhisperer'
159
import { ScanChatControllerEventEmitters, ChatSessionManager } from 'aws-core-vscode/amazonqScan'
1610
import { ScanController } from './chat/controller/controller'
1711
import { AppToWebViewMessageDispatcher } from './chat/views/connector/connector'
1812
import { Messenger } from './chat/controller/messenger/messenger'
1913
import { UIMessageListener } from './chat/views/actions/uiMessageListener'
2014
import { debounce } from 'lodash'
21-
import { Commands, placeholder } from 'aws-core-vscode/shared'
22-
import { codeReviewInChat } from './models/constants'
2315

2416
export function init(appContext: AmazonQAppInitContext) {
2517
const scanChatControllerEventEmitters: ScanChatControllerEventEmitters = {
@@ -50,8 +42,6 @@ export function init(appContext: AmazonQAppInitContext) {
5042
webViewMessageListener: new MessageListener<any>(scanChatUIInputEventEmitter),
5143
})
5244

53-
appContext.registerWebViewToAppMessagePublisher(new MessagePublisher<any>(scanChatUIInputEventEmitter), 'review')
54-
5545
const debouncedEvent = debounce(async () => {
5646
const authenticated = (await AuthUtil.instance.getChatAuthState()).amazonQ === 'connected'
5747
let authenticatingSessionID = ''
@@ -75,20 +65,6 @@ export function init(appContext: AmazonQAppInitContext) {
7565
return debouncedEvent()
7666
})
7767

78-
if (!codeReviewInChat) {
79-
Commands.register('aws.amazonq.security.scan-statusbar', async () => {
80-
if (AuthUtil.instance.isConnectionExpired()) {
81-
await AuthUtil.instance.notifyReauthenticate()
82-
}
83-
return focusAmazonQPanel.execute(placeholder, 'amazonq.security.scan').then(() => {
84-
DefaultAmazonQAppInitContext.instance.getAppsToWebViewMessagePublisher().publish({
85-
sender: 'amazonqCore',
86-
command: 'review',
87-
})
88-
})
89-
})
90-
}
91-
9268
codeScanState.setChatControllers(scanChatControllerEventEmitters)
9369
onDemandFileScanState.setChatControllers(scanChatControllerEventEmitters)
9470
}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ export async function activate(context: ExtensionContext) {
1717
context.subscriptions.push(
1818
amazonq.focusAmazonQChatWalkthrough.register(),
1919
amazonq.walkthroughInlineSuggestionsExample.register(),
20-
amazonq.walkthroughSecurityScanExample.register(),
2120
amazonq.openAmazonQWalkthrough.register(),
2221
amazonq.listCodeWhispererCommandsWalkthrough.register(),
2322
amazonq.focusAmazonQPanel.register(),

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

Lines changed: 68 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,73 @@
55

66
import vscode from 'vscode'
77
import {
8+
acceptSuggestion,
89
AuthUtil,
10+
CodeSuggestionsState,
11+
CodeWhispererCodeCoverageTracker,
912
CodeWhispererConstants,
13+
CodeWhispererSettings,
14+
ConfigurationEntry,
15+
DefaultCodeWhispererClient,
16+
invokeRecommendation,
1017
isInlineCompletionEnabled,
18+
KeyStrokeHandler,
19+
RecommendationHandler,
1120
runtimeLanguageContext,
21+
TelemetryHelper,
1222
UserWrittenCodeTracker,
1323
vsCodeState,
1424
} from 'aws-core-vscode/codewhisperer'
15-
import { globals, sleep } from 'aws-core-vscode/shared'
25+
import { Commands, getLogger, globals, sleep } from 'aws-core-vscode/shared'
26+
import { LanguageClient } from 'vscode-languageclient'
1627

17-
export async function activate() {
18-
if (isInlineCompletionEnabled()) {
19-
// Debugging purpose: only initialize NextEditPredictionPanel when development
20-
// NextEditPredictionPanel.getInstance()
28+
export async function activate(languageClient: LanguageClient) {
29+
const codewhispererSettings = CodeWhispererSettings.instance
30+
const client = new DefaultCodeWhispererClient()
2131

32+
if (isInlineCompletionEnabled()) {
2233
await setSubscriptionsforInlineCompletion()
2334
await AuthUtil.instance.setVscodeContextProps()
35+
RecommendationHandler.instance.setLanguageClient(languageClient)
36+
}
37+
38+
function getAutoTriggerStatus(): boolean {
39+
return CodeSuggestionsState.instance.isSuggestionsEnabled()
40+
}
41+
42+
async function getConfigEntry(): Promise<ConfigurationEntry> {
43+
const isShowMethodsEnabled: boolean =
44+
vscode.workspace.getConfiguration('editor').get('suggest.showMethods') || false
45+
const isAutomatedTriggerEnabled: boolean = getAutoTriggerStatus()
46+
const isManualTriggerEnabled: boolean = true
47+
const isSuggestionsWithCodeReferencesEnabled = codewhispererSettings.isSuggestionsWithCodeReferencesEnabled()
48+
49+
// TODO:remove isManualTriggerEnabled
50+
return {
51+
isShowMethodsEnabled,
52+
isManualTriggerEnabled,
53+
isAutomatedTriggerEnabled,
54+
isSuggestionsWithCodeReferencesEnabled,
55+
}
2456
}
2557

2658
async function setSubscriptionsforInlineCompletion() {
59+
RecommendationHandler.instance.subscribeSuggestionCommands()
60+
2761
/**
2862
* Automated trigger
2963
*/
3064
globals.context.subscriptions.push(
65+
acceptSuggestion.register(globals.context),
66+
vscode.window.onDidChangeActiveTextEditor(async (editor) => {
67+
await RecommendationHandler.instance.onEditorChange()
68+
}),
69+
vscode.window.onDidChangeWindowState(async (e) => {
70+
await RecommendationHandler.instance.onFocusChange()
71+
}),
72+
vscode.window.onDidChangeTextEditorSelection(async (e) => {
73+
await RecommendationHandler.instance.onCursorChange(e)
74+
}),
3175
vscode.workspace.onDidChangeTextDocument(async (e) => {
3276
const editor = vscode.window.activeTextEditor
3377
if (!editor) {
@@ -40,6 +84,7 @@ export async function activate() {
4084
return
4185
}
4286

87+
CodeWhispererCodeCoverageTracker.getTracker(e.document.languageId)?.countTotalTokens(e)
4388
UserWrittenCodeTracker.instance.onTextDocumentChange(e)
4489
/**
4590
* Handle this keystroke event only when
@@ -51,6 +96,11 @@ export async function activate() {
5196
return
5297
}
5398

99+
if (vsCodeState.lastUserModificationTime) {
100+
TelemetryHelper.instance.setTimeSinceLastModification(
101+
performance.now() - vsCodeState.lastUserModificationTime
102+
)
103+
}
54104
vsCodeState.lastUserModificationTime = performance.now()
55105
/**
56106
* Important: Doing this sleep(10) is to make sure
@@ -59,6 +109,19 @@ export async function activate() {
59109
* Then this event can be processed by our code.
60110
*/
61111
await sleep(CodeWhispererConstants.vsCodeCursorUpdateDelay)
112+
if (!RecommendationHandler.instance.isSuggestionVisible()) {
113+
await KeyStrokeHandler.instance.processKeyStroke(e, editor, client, await getConfigEntry())
114+
}
115+
}),
116+
// manual trigger
117+
Commands.register({ id: 'aws.amazonq.invokeInlineCompletion', autoconnect: true }, async () => {
118+
invokeRecommendation(
119+
vscode.window.activeTextEditor as vscode.TextEditor,
120+
client,
121+
await getConfigEntry()
122+
).catch((e: Error) => {
123+
getLogger().error('invokeRecommendation failed: %s', (e as Error).message)
124+
})
62125
})
63126
)
64127
}

packages/amazonq/src/lsp/auth.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ import * as crypto from 'crypto'
1717
import { LanguageClient } from 'vscode-languageclient'
1818
import { AuthUtil } from 'aws-core-vscode/codewhisperer'
1919
import { Writable } from 'stream'
20-
import { onceChanged } from 'aws-core-vscode/utils'
20+
import { onceChanged, onceChangedWithComparator } from 'aws-core-vscode/utils'
2121
import { getLogger, oneMinute, isSageMaker } from 'aws-core-vscode/shared'
22-
import { isSsoConnection, isIamConnection } from 'aws-core-vscode/auth'
22+
import { isSsoConnection, isIamConnection, areCredentialsEqual } from 'aws-core-vscode/auth'
2323

2424
export const encryptionKey = crypto.randomBytes(32)
2525

@@ -108,7 +108,10 @@ export class AmazonQLspAuth {
108108
this.client.info(`UpdateBearerToken: ${JSON.stringify(request)}`)
109109
}
110110

111-
public updateIamCredentials = onceChanged(this._updateIamCredentials.bind(this))
111+
public updateIamCredentials = onceChangedWithComparator(
112+
this._updateIamCredentials.bind(this),
113+
([prevCreds], [currentCreds]) => areCredentialsEqual(prevCreds, currentCreds)
114+
)
112115
private async _updateIamCredentials(credentials: any) {
113116
getLogger().info(
114117
`[SageMaker Debug] Updating IAM credentials - credentials received: ${credentials ? 'YES' : 'NO'}`

0 commit comments

Comments
 (0)