diff --git a/package-lock.json b/package-lock.json index e5f1e7e7a70..cff472d4104 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,7 +20,7 @@ "vscode-nls-dev": "^4.0.4" }, "devDependencies": { - "@aws-toolkits/telemetry": "^1.0.318", + "@aws-toolkits/telemetry": "^1.0.319", "@playwright/browser-chromium": "^1.43.1", "@stylistic/eslint-plugin": "^2.11.0", "@types/he": "^1.2.3", @@ -10760,10 +10760,11 @@ } }, "node_modules/@aws-toolkits/telemetry": { - "version": "1.0.318", - "resolved": "https://registry.npmjs.org/@aws-toolkits/telemetry/-/telemetry-1.0.318.tgz", - "integrity": "sha512-L64GJ+KRN0fdTIx1CPIbbgBeFcg9DilsIxfjeZyod7ld0mw6he70rPopBtK4jP+pTEkfUE4wTRsaco1nWXz3+w==", + "version": "1.0.321", + "resolved": "https://registry.npmjs.org/@aws-toolkits/telemetry/-/telemetry-1.0.321.tgz", + "integrity": "sha512-pL1TZOyREfEuZjvjhAPyb/6fOaPLlXMft4i1mbHJVs2rnJBKFAsJOl3osmCLKXuqiMT7jhmzOE8dRCkEuLleIw==", "dev": true, + "license": "Apache-2.0", "dependencies": { "ajv": "^6.12.6", "cross-spawn": "^7.0.6", @@ -10786,8 +10787,6 @@ }, "node_modules/@aws/chat-client-ui-types": { "version": "0.1.26", - "resolved": "https://registry.npmjs.org/@aws/chat-client-ui-types/-/chat-client-ui-types-0.1.26.tgz", - "integrity": "sha512-WlF0fP1nojueknr815dg6Ivs+Q3e5onvWTH1nI05jysSzUHjsWwFDBrsxqJXfaPIFhPrbQzHqoxHbhIwQ1OLuw==", "dev": true, "license": "Apache-2.0", "dependencies": { @@ -10829,8 +10828,6 @@ }, "node_modules/@aws/language-server-runtimes-types": { "version": "0.1.26", - "resolved": "https://registry.npmjs.org/@aws/language-server-runtimes-types/-/language-server-runtimes-types-0.1.26.tgz", - "integrity": "sha512-c63rpUbcrtLqaC33t6elRApQqLbQvFgKzIQ2z/VCavE5F7HSLBfzhHkhgUFd775fBpsF4MHrIzwNitYLhDGobw==", "dev": true, "license": "Apache-2.0", "dependencies": { @@ -11781,8 +11778,6 @@ }, "node_modules/@aws/mynah-ui": { "version": "4.30.3", - "resolved": "https://registry.npmjs.org/@aws/mynah-ui/-/mynah-ui-4.30.3.tgz", - "integrity": "sha512-Xy22dzCaFUqpdSHMpLa8Dsq98DiAUq49dm7Iu8Yj2YZXSCyfKQiYMJOfwU8IoqeNcEney5JRMJpf+/RysWugbA==", "hasInstallScript": true, "license": "Apache License 2.0", "dependencies": { @@ -24693,9 +24688,8 @@ }, "node_modules/ts-node": { "version": "10.9.2", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", - "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", "dev": true, + "license": "MIT", "dependencies": { "@cspotcode/source-map-support": "^0.8.0", "@tsconfig/node10": "^1.0.7", diff --git a/package.json b/package.json index f4b31c22d83..493327237eb 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "skippedTestReport": "ts-node ./scripts/skippedTestReport.ts ./packages/amazonq/test/e2e/" }, "devDependencies": { - "@aws-toolkits/telemetry": "^1.0.318", + "@aws-toolkits/telemetry": "^1.0.319", "@playwright/browser-chromium": "^1.43.1", "@stylistic/eslint-plugin": "^2.11.0", "@types/he": "^1.2.3", diff --git a/packages/amazonq/.changes/next-release/Bug Fix-bb976b5f-7697-42d8-89a9-8e96310a23f4.json b/packages/amazonq/.changes/next-release/Bug Fix-bb976b5f-7697-42d8-89a9-8e96310a23f4.json new file mode 100644 index 00000000000..988fb2bcc7b --- /dev/null +++ b/packages/amazonq/.changes/next-release/Bug Fix-bb976b5f-7697-42d8-89a9-8e96310a23f4.json @@ -0,0 +1,4 @@ +{ + "type": "Bug Fix", + "description": "Support chat in AL2 aarch64" +} diff --git a/packages/amazonq/src/extension.ts b/packages/amazonq/src/extension.ts index 9d9c3061e6b..a84c68fff4c 100644 --- a/packages/amazonq/src/extension.ts +++ b/packages/amazonq/src/extension.ts @@ -33,7 +33,7 @@ import { maybeShowMinVscodeWarning, Experiments, isSageMaker, - isAmazonInternalOs, + isAmazonLinux2, } from 'aws-core-vscode/shared' import { ExtStartUpSources } from 'aws-core-vscode/telemetry' import { VSCODE_EXTENSION_ID } from 'aws-core-vscode/utils' @@ -123,7 +123,7 @@ export async function activateAmazonQCommon(context: vscode.ExtensionContext, is await activateCodeWhisperer(extContext as ExtContext) if ( (Experiments.instance.get('amazonqLSP', true) || Auth.instance.isInternalAmazonUser()) && - (!isAmazonInternalOs() || (await hasGlibcPatch())) + (!isAmazonLinux2() || hasGlibcPatch()) ) { // start the Amazon Q LSP for internal users first // for AL2, start LSP if glibc patch is found diff --git a/packages/amazonq/src/lsp/chat/activation.ts b/packages/amazonq/src/lsp/chat/activation.ts index 9dd1d31c3de..3a36377b9b5 100644 --- a/packages/amazonq/src/lsp/chat/activation.ts +++ b/packages/amazonq/src/lsp/chat/activation.ts @@ -25,6 +25,11 @@ export async function activate(languageClient: LanguageClient, encryptionKey: Bu type: 'profile', profileArn: AuthUtil.instance.regionProfileManager.activeRegionProfile?.arn, }) + // We need to push the cached customization on startup explicitly + await pushConfigUpdate(languageClient, { + type: 'customization', + customization: getSelectedCustomization(), + }) const provider = new AmazonQChatViewProvider(mynahUIPath) diff --git a/packages/amazonq/src/lsp/client.ts b/packages/amazonq/src/lsp/client.ts index 0884c885607..f5159328605 100644 --- a/packages/amazonq/src/lsp/client.ts +++ b/packages/amazonq/src/lsp/client.ts @@ -36,8 +36,7 @@ import { getLogger, undefinedIfEmpty, getOptOutPreference, - isAmazonInternalOs, - fs, + isAmazonLinux2, getClientId, extensionVersion, } from 'aws-core-vscode/shared' @@ -55,8 +54,11 @@ import { InlineChatTutorialAnnotation } from '../app/inline/tutorials/inlineChat const localize = nls.loadMessageBundle() const logger = getLogger('amazonqLsp.lspClient') -export async function hasGlibcPatch(): Promise { - return await fs.exists('/opt/vsc-sysroot/lib64/ld-linux-x86-64.so.2') +export const glibcLinker: string = process.env.VSCODE_SERVER_CUSTOM_GLIBC_LINKER || '' +export const glibcPath: string = process.env.VSCODE_SERVER_CUSTOM_GLIBC_PATH || '' + +export function hasGlibcPatch(): boolean { + return glibcLinker.length > 0 && glibcPath.length > 0 } export async function startLanguageServer( @@ -81,13 +83,8 @@ export async function startLanguageServer( const traceServerEnabled = Settings.instance.isSet(`${clientId}.trace.server`) let executable: string[] = [] // apply the GLIBC 2.28 path to node js runtime binary - if (isAmazonInternalOs() && (await hasGlibcPatch())) { - executable = [ - '/opt/vsc-sysroot/lib64/ld-linux-x86-64.so.2', - '--library-path', - '/opt/vsc-sysroot/lib64', - resourcePaths.node, - ] + if (isAmazonLinux2() && hasGlibcPatch()) { + executable = [glibcLinker, '--library-path', glibcPath, resourcePaths.node] getLogger('amazonqLsp').info(`Patched node runtime with GLIBC to ${executable}`) } else { executable = [resourcePaths.node] @@ -380,6 +377,8 @@ function getConfigSection(section: ConfigSection) { includeSuggestionsWithCodeReferences: CodeWhispererSettings.instance.isSuggestionsWithCodeReferencesEnabled(), shareCodeWhispererContentWithAWS: !CodeWhispererSettings.instance.isOptoutEnabled(), + includeImportsWithSuggestions: CodeWhispererSettings.instance.isImportRecommendationEnabled(), + sendUserWrittenCodeMetrics: true, }, ] case 'aws.logLevel': diff --git a/packages/core/src/shared/index.ts b/packages/core/src/shared/index.ts index 2d23400c9bb..76e83258c12 100644 --- a/packages/core/src/shared/index.ts +++ b/packages/core/src/shared/index.ts @@ -18,7 +18,7 @@ export * from './extensionUtilities' export * from './extensionStartup' export { RegionProvider } from './regions/regionProvider' export { Commands } from './vscode/commands2' -export { getMachineId, getServiceEnvVarConfig, isAmazonInternalOs } from './vscode/env' +export { getMachineId, getServiceEnvVarConfig, isAmazonLinux2 } from './vscode/env' export { getLogger } from './logger/logger' export { activateExtension, openUrl } from './utilities/vsCodeUtils' export { waitUntil, sleep, Timeout } from './utilities/timeoutUtils' diff --git a/packages/core/src/shared/telemetry/util.ts b/packages/core/src/shared/telemetry/util.ts index 4d136bc96f0..310c36b82d6 100644 --- a/packages/core/src/shared/telemetry/util.ts +++ b/packages/core/src/shared/telemetry/util.ts @@ -15,7 +15,7 @@ import { isAutomation, isRemoteWorkspace, isCloudDesktop, - isAmazonInternalOs, + isAmazonLinux2, } from '../vscode/env' import { addTypeName } from '../utilities/typeConstructors' import globals, { isWeb } from '../extensionGlobals' @@ -290,7 +290,7 @@ export async function getComputeEnvType(): Promise { } else if (isSageMaker()) { return web ? 'sagemaker-web' : 'sagemaker' } else if (isRemoteWorkspace()) { - if (isAmazonInternalOs()) { + if (isAmazonLinux2()) { if (await isCloudDesktop()) { return 'cloudDesktop-amzn' } diff --git a/packages/core/src/shared/vscode/env.ts b/packages/core/src/shared/vscode/env.ts index 004db0efc27..02d46ae6695 100644 --- a/packages/core/src/shared/vscode/env.ts +++ b/packages/core/src/shared/vscode/env.ts @@ -125,23 +125,21 @@ export function isRemoteWorkspace(): boolean { } /** - * There is Amazon Linux 2, but additionally an Amazon Linux 2 Internal. - * The internal version is for Amazon employees only. And this version can - * be used by either EC2 OR CloudDesktop. It is not exclusive to either. + * There is Amazon Linux 2. * - * Use {@link isCloudDesktop()} to know if we are specifically using it. + * Use {@link isCloudDesktop()} to know if we are specifically using internal Amazon Linux 2. * - * Example: `5.10.220-188.869.amzn2int.x86_64` + * Example: `5.10.220-188.869.amzn2int.x86_64` or `5.10.236-227.928.amzn2.x86_64` (Cloud Dev Machine) */ -export function isAmazonInternalOs() { - return os.release().includes('amzn2int') && process.platform === 'linux' +export function isAmazonLinux2() { + return (os.release().includes('.amzn2int.') || os.release().includes('.amzn2.')) && process.platform === 'linux' } /** * Returns true if we are in an internal Amazon Cloud Desktop */ export async function isCloudDesktop() { - if (!isAmazonInternalOs()) { + if (!isAmazonLinux2()) { return false } diff --git a/packages/core/src/test/shared/vscode/env.test.ts b/packages/core/src/test/shared/vscode/env.test.ts index ef81bdf05ab..cf09d085e68 100644 --- a/packages/core/src/test/shared/vscode/env.test.ts +++ b/packages/core/src/test/shared/vscode/env.test.ts @@ -5,13 +5,7 @@ import assert from 'assert' import path from 'path' -import { - isCloudDesktop, - getEnvVars, - getServiceEnvVarConfig, - isAmazonInternalOs as isAmazonInternalOS, - isBeta, -} from '../../../shared/vscode/env' +import { isCloudDesktop, getEnvVars, getServiceEnvVarConfig, isAmazonLinux2, isBeta } from '../../../shared/vscode/env' import { ChildProcess } from '../../../shared/utilities/processUtils' import * as sinon from 'sinon' import os from 'os' @@ -103,13 +97,16 @@ describe('env', function () { assert.strictEqual(isBeta(), expected) }) - it('isAmazonInternalOS', function () { + it('isAmazonLinux2', function () { sandbox.stub(process, 'platform').value('linux') const versionStub = stubOsVersion('5.10.220-188.869.amzn2int.x86_64') - assert.strictEqual(isAmazonInternalOS(), true) + assert.strictEqual(isAmazonLinux2(), true) + + versionStub.returns('5.10.236-227.928.amzn2.x86_64') + assert.strictEqual(isAmazonLinux2(), true) versionStub.returns('5.10.220-188.869.NOT_INTERNAL.x86_64') - assert.strictEqual(isAmazonInternalOS(), false) + assert.strictEqual(isAmazonLinux2(), false) }) it('isCloudDesktop', async function () {