diff --git a/.changes/next-release/bugfix-0bcc1352-2203-4a45-b205-4b71cf93941a.json b/.changes/next-release/bugfix-0bcc1352-2203-4a45-b205-4b71cf93941a.json new file mode 100644 index 00000000000..bb1d145fa01 --- /dev/null +++ b/.changes/next-release/bugfix-0bcc1352-2203-4a45-b205-4b71cf93941a.json @@ -0,0 +1,4 @@ +{ + "type" : "bugfix", + "description" : "Amazon Q: Fixed quick action command list inconsistency between Q tabs" +} \ No newline at end of file diff --git a/.changes/next-release/bugfix-a1fe7822-625c-4447-9bd8-108d0ab088bb.json b/.changes/next-release/bugfix-a1fe7822-625c-4447-9bd8-108d0ab088bb.json new file mode 100644 index 00000000000..e7f9cc894df --- /dev/null +++ b/.changes/next-release/bugfix-a1fe7822-625c-4447-9bd8-108d0ab088bb.json @@ -0,0 +1,4 @@ +{ + "type" : "bugfix", + "description" : "Amazon Q: Fixed cursor not focuses to prompt input when code is sent to Q Chat" +} \ No newline at end of file diff --git a/.changes/next-release/feature-cb653e4f-ff0b-4aa9-82a1-8d9128709ea3.json b/.changes/next-release/feature-cb653e4f-ff0b-4aa9-82a1-8d9128709ea3.json new file mode 100644 index 00000000000..a5a67797430 --- /dev/null +++ b/.changes/next-release/feature-cb653e4f-ff0b-4aa9-82a1-8d9128709ea3.json @@ -0,0 +1,4 @@ +{ + "type" : "feature", + "description" : "Amazon Q: Added description and a new tab button when there is no tab open" +} \ No newline at end of file diff --git a/plugins/amazonq/mynah-ui/package-lock.json b/plugins/amazonq/mynah-ui/package-lock.json index 43a16ea1483..d53a644e62d 100644 --- a/plugins/amazonq/mynah-ui/package-lock.json +++ b/plugins/amazonq/mynah-ui/package-lock.json @@ -9,7 +9,7 @@ "version": "1.0.0", "license": "ISC", "dependencies": { - "@aws/mynah-ui-chat": "npm:@aws/mynah-ui@4.4.2", + "@aws/mynah-ui-chat": "npm:@aws/mynah-ui@4.5.5", "@types/node": "^14.18.5", "fs-extra": "^10.0.1", "sanitize-html": "^2.12.1", @@ -57,9 +57,9 @@ }, "node_modules/@aws/mynah-ui-chat": { "name": "@aws/mynah-ui", - "version": "4.4.2", - "resolved": "https://registry.npmjs.org/@aws/mynah-ui/-/mynah-ui-4.4.2.tgz", - "integrity": "sha512-ctpSGdG2BLPZktzAzvpcGYsm/53eMS7ig9oUxkFrqGcZhYoPoK3Obc/zBGMhxduhYeOcXYhd70laiPO8rTVyCA==", + "version": "4.5.5", + "resolved": "https://registry.npmjs.org/@aws/mynah-ui/-/mynah-ui-4.5.5.tgz", + "integrity": "sha512-xvqr46XFfCWxcHsQURnDuHHs0GLJaCBanJpV22t9TBf/BNjzJN8aBM7AGYwXvZbykRKIGNpHnvQnKlMfVvr/aQ==", "hasInstallScript": true, "dependencies": { "just-clone": "^6.2.0", diff --git a/plugins/amazonq/mynah-ui/package.json b/plugins/amazonq/mynah-ui/package.json index c49cbc06eae..57ab0096db5 100644 --- a/plugins/amazonq/mynah-ui/package.json +++ b/plugins/amazonq/mynah-ui/package.json @@ -12,7 +12,7 @@ "lintfix": "eslint -c .eslintrc.js --fix --ext .ts ." }, "dependencies": { - "@aws/mynah-ui-chat": "npm:@aws/mynah-ui@4.4.2", + "@aws/mynah-ui-chat": "npm:@aws/mynah-ui@4.5.5", "@types/node": "^14.18.5", "fs-extra": "^10.0.1", "ts-node": "^10.7.0", diff --git a/plugins/amazonq/mynah-ui/src/mynah-ui/ui/quickActions/generator.ts b/plugins/amazonq/mynah-ui/src/mynah-ui/ui/quickActions/generator.ts index 6f1d722a945..17770b4cbf1 100644 --- a/plugins/amazonq/mynah-ui/src/mynah-ui/ui/quickActions/generator.ts +++ b/plugins/amazonq/mynah-ui/src/mynah-ui/ui/quickActions/generator.ts @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { QuickActionCommandGroup } from '@aws/mynah-ui-chat/dist/static' +import { QuickActionCommand, QuickActionCommandGroup } from '@aws/mynah-ui-chat/dist/static' import { TabType } from '../storages/tabsStorage' export interface QuickActionGeneratorProps { @@ -21,51 +21,89 @@ export class QuickActionGenerator { } public generateForTab(tabType: TabType): QuickActionCommandGroup[] { - switch (tabType) { - case 'featuredev': - return [] - default: - return [ - ...(this.isFeatureDevEnabled - ? [ - { - groupName: 'Application Development', - commands: [ - { - command: '/dev', - placeholder: 'Briefly describe a task or issue', - description: - 'Use all project files as context for code suggestions (increases latency).', - }, - ], - }, - ] - : []), - ...(this.isCodeTransformEnabled - ? [ - { - commands: [ - { - command: '/transform', - description: 'Transform your Java 8 or 11 Maven project to Java 17', - }, - ], - }, - ] - : []), + const quickActionCommands = [ + ...(this.isFeatureDevEnabled + ? [ { + groupName: 'Application Development', commands: [ { - command: '/help', - description: 'Learn more about Amazon Q', + command: '/dev', + placeholder: 'Briefly describe a task or issue', + description: + 'Use all project files as context for code suggestions (increases latency).', }, + ], + }, + ] + : []), + ...(this.isCodeTransformEnabled + ? [ + { + commands: [ { - command: '/clear', - description: 'Clear this session', + command: '/transform', + description: 'Transform your Java 8 or 11 Maven project to Java 17', }, ], }, ] + : []), + { + commands: [ + { + command: '/help', + description: 'Learn more about Amazon Q', + }, + { + command: '/clear', + description: 'Clear this session', + }, + ], + }, + ] + + const commandUnavailability: Record< + TabType, + { + description: string + unavailableItems: string[] + } + > = { + cwc: { + description: '', + unavailableItems: [], + }, + featuredev: { + description: "This command isn't available in /dev", + unavailableItems: ['/dev', '/transform', '/help', '/clear'], + }, + codetransform: { + description: "This command isn't available in /transform", + unavailableItems: ['/dev', '/transform'], + }, + unknown: { + description: "", + unavailableItems: [], + }, } + + return structuredClone(quickActionCommands).map(commandGroup => { + return { + groupName: commandGroup.groupName, + commands: commandGroup.commands.map((commandItem: QuickActionCommand) => { + const commandNotAvailable = commandUnavailability[tabType].unavailableItems.includes( + commandItem.command + ) + return { + ...commandItem, + disabled: commandNotAvailable, + description: commandNotAvailable + ? commandUnavailability[tabType].description + : commandItem.description, + } + }) as QuickActionCommand[], + } + }) as QuickActionCommandGroup[] } }