From aedffcdea7bd65f1021215560741bd92f77d0a27 Mon Sep 17 00:00:00 2001 From: laileni Date: Mon, 28 Jul 2025 10:05:18 -0700 Subject: [PATCH] refactor: removing agentWalkThrough workflow --- packages/amazonq/package.json | 17 +- .../amazonq/test/e2e/amazonq/explore.test.ts | 45 ---- packages/core/package.nls.json | 1 - .../ui/apps/amazonqCommonsConnector.ts | 7 +- .../core/src/amazonq/webview/ui/connector.ts | 4 - packages/core/src/amazonq/webview/ui/main.ts | 14 -- .../webview/ui/quickActions/generator.ts | 7 +- .../webview/ui/storages/tabsStorage.ts | 2 +- .../src/amazonq/webview/ui/tabs/constants.ts | 2 +- .../src/amazonq/webview/ui/tabs/generator.ts | 7 +- .../amazonq/webview/ui/walkthrough/agent.ts | 201 ------------------ packages/core/src/codewhisperer/activation.ts | 2 - .../codewhisperer/commands/basicCommands.ts | 15 -- 13 files changed, 8 insertions(+), 316 deletions(-) delete mode 100644 packages/amazonq/test/e2e/amazonq/explore.test.ts delete mode 100644 packages/core/src/amazonq/webview/ui/walkthrough/agent.ts diff --git a/packages/amazonq/package.json b/packages/amazonq/package.json index d791ba05af3..58161b6ffdb 100644 --- a/packages/amazonq/package.json +++ b/packages/amazonq/package.json @@ -524,22 +524,17 @@ "command": "aws.amazonq.walkthrough.show", "group": "1_help@1" }, - { - "command": "aws.amazonq.exploreAgents", - "when": "!aws.isSageMaker", - "group": "1_help@2" - }, { "command": "aws.amazonq.github", - "group": "1_help@3" + "group": "1_help@2" }, { "command": "aws.amazonq.aboutExtension", - "group": "1_help@4" + "group": "1_help@3" }, { "command": "aws.amazonq.viewLogs", - "group": "1_help@5" + "group": "1_help@4" } ], "aws.amazonq.submenu.securityIssueMoreActions": [ @@ -846,12 +841,6 @@ "title": "%AWS.amazonq.openChat%", "category": "%AWS.amazonq.title%" }, - { - "command": "aws.amazonq.exploreAgents", - "title": "%AWS.amazonq.exploreAgents%", - "category": "%AWS.amazonq.title%", - "enablement": "aws.codewhisperer.connected && !aws.isSageMaker" - }, { "command": "aws.amazonq.walkthrough.show", "title": "%AWS.amazonq.welcomeWalkthrough%" diff --git a/packages/amazonq/test/e2e/amazonq/explore.test.ts b/packages/amazonq/test/e2e/amazonq/explore.test.ts deleted file mode 100644 index 970d93d00bb..00000000000 --- a/packages/amazonq/test/e2e/amazonq/explore.test.ts +++ /dev/null @@ -1,45 +0,0 @@ -/*! - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -import assert from 'assert' -import sinon from 'sinon' -import { qTestingFramework } from './framework/framework' -import { Messenger } from './framework/messenger' - -describe('Amazon Q Explore page', function () { - let framework: qTestingFramework - let tab: Messenger - - beforeEach(() => { - framework = new qTestingFramework('agentWalkthrough', true, [], 0) - const welcomeTab = framework.getTabs()[0] - welcomeTab.clickInBodyButton('explore') - - // Find the new explore tab - const exploreTab = framework.findTab('Explore') - if (!exploreTab) { - assert.fail('Explore tab not found') - } - tab = exploreTab - }) - - afterEach(() => { - framework.removeTab(tab.tabID) - framework.dispose() - sinon.restore() - }) - - // TODO refactor page objects so we can associate clicking user guides with actual urls - // TODO test that clicking quick start changes the tab title, etc - it('should have correct button IDs', async () => { - const features = ['featuredev', 'testgen', 'doc', 'review', 'gumby'] - - for (const [index, feature] of features.entries()) { - const buttons = (tab.getStore().chatItems ?? [])[index].buttons ?? [] - assert.deepStrictEqual(buttons[0].id, `user-guide-${feature}`) - assert.deepStrictEqual(buttons[1].id, `quick-start-${feature}`) - } - }) -}) diff --git a/packages/core/package.nls.json b/packages/core/package.nls.json index 0a25550ec22..498a3583a00 100644 --- a/packages/core/package.nls.json +++ b/packages/core/package.nls.json @@ -354,7 +354,6 @@ "AWS.amazonq.security": "Code Issues", "AWS.amazonq.login": "Login", "AWS.amazonq.learnMore": "Learn More About Amazon Q", - "AWS.amazonq.exploreAgents": "Explore Agent Capabilities", "AWS.amazonq.welcomeWalkthrough": "Welcome Walkthrough", "AWS.amazonq.codewhisperer.title": "Amazon Q", "AWS.amazonq.toggleCodeSuggestion": "Toggle Auto-Suggestions", diff --git a/packages/core/src/amazonq/webview/ui/apps/amazonqCommonsConnector.ts b/packages/core/src/amazonq/webview/ui/apps/amazonqCommonsConnector.ts index 68983b6c188..ee20b9b0726 100644 --- a/packages/core/src/amazonq/webview/ui/apps/amazonqCommonsConnector.ts +++ b/packages/core/src/amazonq/webview/ui/apps/amazonqCommonsConnector.ts @@ -33,14 +33,12 @@ export interface CodeReference { export class Connector { private readonly sendMessageToExtension private readonly onWelcomeFollowUpClicked - private readonly onNewTab private readonly handleCommand private readonly sendStaticMessage constructor(props: ConnectorProps) { this.sendMessageToExtension = props.sendMessageToExtension this.onWelcomeFollowUpClicked = props.onWelcomeFollowUpClicked - this.onNewTab = props.onNewTab this.handleCommand = props.handleCommand this.sendStaticMessage = props.sendStaticMessages } @@ -61,10 +59,7 @@ export class Connector { } handleMessageReceive = async (messageData: any): Promise => { - if (messageData.command === 'showExploreAgentsView') { - this.onNewTab('agentWalkthrough') - return - } else if (messageData.command === 'review') { + if (messageData.command === 'review') { // tabID does not exist when calling from QuickAction Menu bar this.handleCommand({ command: '/review' }, '') return diff --git a/packages/core/src/amazonq/webview/ui/connector.ts b/packages/core/src/amazonq/webview/ui/connector.ts index cc1b010375a..97821fc842f 100644 --- a/packages/core/src/amazonq/webview/ui/connector.ts +++ b/packages/core/src/amazonq/webview/ui/connector.ts @@ -596,10 +596,6 @@ export class Connector { this.cwChatConnector.onCustomFormAction(tabId, action) } break - case 'agentWalkthrough': { - this.amazonqCommonsConnector.onCustomFormAction(tabId, action) - break - } } } } diff --git a/packages/core/src/amazonq/webview/ui/main.ts b/packages/core/src/amazonq/webview/ui/main.ts index 54696982ae0..c6df42f0566 100644 --- a/packages/core/src/amazonq/webview/ui/main.ts +++ b/packages/core/src/amazonq/webview/ui/main.ts @@ -32,7 +32,6 @@ import { DiffTreeFileInfo } from './diffTree/types' import { FeatureContext } from '../../../shared/featureConfig' import { tryNewMap } from '../../util/functionUtils' import { welcomeScreenTabData } from './walkthrough/welcome' -import { agentWalkthroughDataModel } from './walkthrough/agent' import { createClickTelemetry, createOpenAgentTelemetry } from './telemetry/actions' import { disclaimerAcknowledgeButtonId, disclaimerCard } from './texts/disclaimer' import { DetailedListSheetProps } from '@aws/mynah-ui/dist/components/detailed-list/detailed-list-sheet' @@ -783,19 +782,6 @@ export class WebviewUIHandler { this.postMessage(createClickTelemetry('amazonq-welcome-quick-start-button')) return } - case 'explore': { - const newTabId = this.mynahUI?.updateStore('', agentWalkthroughDataModel) - if (newTabId === undefined) { - this.mynahUI?.notify({ - content: uiComponentsTexts.noMoreTabsTooltip, - type: NotificationType.WARNING, - }) - return - } - this.tabsStorage.updateTabTypeFromUnknown(newTabId, 'agentWalkthrough') - this.postMessage(createClickTelemetry('amazonq-welcome-explore-button')) - return - } default: { this.connector?.onCustomFormAction(tabId, messageId, action, eventId) return diff --git a/packages/core/src/amazonq/webview/ui/quickActions/generator.ts b/packages/core/src/amazonq/webview/ui/quickActions/generator.ts index 0cc7740f2ec..4ca8b4cc10e 100644 --- a/packages/core/src/amazonq/webview/ui/quickActions/generator.ts +++ b/packages/core/src/amazonq/webview/ui/quickActions/generator.ts @@ -25,11 +25,6 @@ export class QuickActionGenerator { } public generateForTab(tabType: TabType): QuickActionCommandGroup[] { - // agentWalkthrough is static and doesn't have any quick actions - if (tabType === 'agentWalkthrough') { - return [] - } - // TODO: Update acc to UX const quickActionCommands = [ { @@ -101,7 +96,7 @@ export class QuickActionGenerator { ].filter((section) => section.commands.length > 0) const commandUnavailability: Record< - Exclude, + Exclude, { description: string unavailableItems: string[] diff --git a/packages/core/src/amazonq/webview/ui/storages/tabsStorage.ts b/packages/core/src/amazonq/webview/ui/storages/tabsStorage.ts index 92fa7c5a07e..2a803759fd0 100644 --- a/packages/core/src/amazonq/webview/ui/storages/tabsStorage.ts +++ b/packages/core/src/amazonq/webview/ui/storages/tabsStorage.ts @@ -4,7 +4,7 @@ */ export type TabStatus = 'free' | 'busy' | 'dead' -const TabTypes = ['cwc', 'gumby', 'review', 'agentWalkthrough', 'welcome', 'unknown'] as const +const TabTypes = ['cwc', 'gumby', 'review', 'welcome', 'unknown'] as const export type TabType = (typeof TabTypes)[number] export function isTabType(value: string): value is TabType { return (TabTypes as readonly string[]).includes(value) diff --git a/packages/core/src/amazonq/webview/ui/tabs/constants.ts b/packages/core/src/amazonq/webview/ui/tabs/constants.ts index ead70679b7f..0872b829a6a 100644 --- a/packages/core/src/amazonq/webview/ui/tabs/constants.ts +++ b/packages/core/src/amazonq/webview/ui/tabs/constants.ts @@ -44,7 +44,7 @@ export const commonTabData: TabTypeData = { contextCommands: [workspaceCommand], } -export const TabTypeDataMap: Record, TabTypeData> = { +export const TabTypeDataMap: Record, TabTypeData> = { unknown: commonTabData, cwc: commonTabData, gumby: { diff --git a/packages/core/src/amazonq/webview/ui/tabs/generator.ts b/packages/core/src/amazonq/webview/ui/tabs/generator.ts index 2331a0721c7..68b758d51cb 100644 --- a/packages/core/src/amazonq/webview/ui/tabs/generator.ts +++ b/packages/core/src/amazonq/webview/ui/tabs/generator.ts @@ -8,7 +8,6 @@ import { TabType } from '../storages/tabsStorage' import { FollowUpGenerator } from '../followUps/generator' import { QuickActionGenerator } from '../quickActions/generator' import { qChatIntroMessageForSMUS, TabTypeDataMap } from './constants' -import { agentWalkthroughDataModel } from '../walkthrough/agent' import { FeatureContext } from '../../../../shared/featureConfig' import { RegionProfile } from '../../../../codewhisperer/models/model' @@ -43,10 +42,6 @@ export class TabDataGenerator { taskName?: string, isSMUS?: boolean ): MynahUIDataModel { - if (tabType === 'agentWalkthrough') { - return agentWalkthroughDataModel - } - if (tabType === 'welcome') { return {} } @@ -86,7 +81,7 @@ export class TabDataGenerator { } private getContextCommands(tabType: TabType): QuickActionCommandGroup[] | undefined { - if (tabType === 'agentWalkthrough' || tabType === 'welcome') { + if (tabType === 'welcome') { return } diff --git a/packages/core/src/amazonq/webview/ui/walkthrough/agent.ts b/packages/core/src/amazonq/webview/ui/walkthrough/agent.ts deleted file mode 100644 index f4a5add7aa1..00000000000 --- a/packages/core/src/amazonq/webview/ui/walkthrough/agent.ts +++ /dev/null @@ -1,201 +0,0 @@ -/*! - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -import { ChatItemContent, ChatItemType, MynahIcons, MynahUIDataModel } from '@aws/mynah-ui' - -function createdTabbedData(examples: string[], agent: string): ChatItemContent['tabbedContent'] { - const exampleText = examples.map((example) => `- ${example}`).join('\n') - return [ - { - label: 'Examples', - value: 'examples', - content: { - body: `**Example use cases:**\n${exampleText}\n\nEnter ${agent} in Q Chat to get started`, - }, - }, - ] -} - -export const agentWalkthroughDataModel: MynahUIDataModel = { - tabBackground: false, - compactMode: false, - tabTitle: 'Explore', - promptInputVisible: false, - tabHeaderDetails: { - icon: MynahIcons.ASTERISK, - title: 'Amazon Q Developer agents capabilities', - description: '', - }, - chatItems: [ - { - type: ChatItemType.ANSWER, - snapToTop: true, - hoverEffect: true, - body: `### Feature development -Implement features or make changes across your workspace, all from a single prompt. -`, - icon: MynahIcons.CODE_BLOCK, - footer: { - tabbedContent: createdTabbedData( - [ - '/dev update app.py to add a new api', - '/dev fix the error', - '/dev add a new button to sort by ', - ], - '/dev' - ), - }, - buttons: [ - { - status: 'clear', - id: `user-guide-featuredev`, - disabled: false, - text: 'Read user guide', - }, - { - status: 'main', - disabled: false, - flash: 'once', - fillState: 'hover', - icon: MynahIcons.RIGHT_OPEN, - id: 'quick-start-featuredev', - text: `Quick start with **/dev**`, - }, - ], - }, - { - type: ChatItemType.ANSWER, - hoverEffect: true, - body: `### Unit test generation -Automatically generate unit tests for your active file. -`, - icon: MynahIcons.BUG, - footer: { - tabbedContent: createdTabbedData( - ['Generate tests for specific functions', 'Generate tests for null and empty inputs'], - '/test' - ), - }, - buttons: [ - { - status: 'clear', - id: 'user-guide-testgen', - disabled: false, - text: 'Read user guide', - }, - { - status: 'main', - disabled: false, - flash: 'once', - fillState: 'hover', - icon: MynahIcons.RIGHT_OPEN, - id: 'quick-start-testgen', - text: `Quick start with **/test**`, - }, - ], - }, - { - type: ChatItemType.ANSWER, - hoverEffect: true, - body: `### Documentation generation -Create and update READMEs for better documented code. -`, - icon: MynahIcons.CHECK_LIST, - footer: { - tabbedContent: createdTabbedData( - [ - 'Generate new READMEs for your project', - 'Update existing READMEs with recent code changes', - 'Request specific changes to a README', - ], - '/doc' - ), - }, - buttons: [ - { - status: 'clear', - id: 'user-guide-doc', - disabled: false, - text: 'Read user guide', - }, - { - status: 'main', - disabled: false, - flash: 'once', - fillState: 'hover', - icon: MynahIcons.RIGHT_OPEN, - id: 'quick-start-doc', - text: `Quick start with **/doc**`, - }, - ], - }, - { - type: ChatItemType.ANSWER, - hoverEffect: true, - body: `### Code reviews -Review code for issues, then get suggestions to fix your code instantaneously. -`, - icon: MynahIcons.TRANSFORM, - footer: { - tabbedContent: createdTabbedData( - [ - 'Review code for security vulnerabilities and code quality issues', - 'Get detailed explanations about code issues', - 'Apply automatic code fixes to your files', - ], - '/review' - ), - }, - buttons: [ - { - status: 'clear', - id: 'user-guide-review', - disabled: false, - text: 'Read user guide', - }, - { - status: 'main', - disabled: false, - flash: 'once', - fillState: 'hover', - icon: MynahIcons.RIGHT_OPEN, - id: 'quick-start-review', - text: `Quick start with **/review**`, - }, - ], - }, - { - type: ChatItemType.ANSWER, - hoverEffect: true, - body: `### Transformation -Upgrade library and language versions in your codebase. -`, - icon: MynahIcons.TRANSFORM, - footer: { - tabbedContent: createdTabbedData( - ['Upgrade Java language and dependency versions', 'Convert embedded SQL code in Java apps'], - '/transform' - ), - }, - buttons: [ - { - status: 'clear', - id: 'user-guide-gumby', - disabled: false, - text: 'Read user guide', - }, - { - status: 'main', - disabled: false, - flash: 'once', - fillState: 'hover', - icon: MynahIcons.RIGHT_OPEN, - id: 'quick-start-gumby', - text: `Quick start with **/transform**`, - }, - ], - }, - ], -} diff --git a/packages/core/src/codewhisperer/activation.ts b/packages/core/src/codewhisperer/activation.ts index 1e73b640a1e..941156a0d2e 100644 --- a/packages/core/src/codewhisperer/activation.ts +++ b/packages/core/src/codewhisperer/activation.ts @@ -49,7 +49,6 @@ import { regenerateFix, ignoreAllIssues, focusIssue, - showExploreAgentsView, showCodeIssueGroupingQuickPick, selectRegionProfileCommand, } from './commands/basicCommands' @@ -301,7 +300,6 @@ export async function activate(context: ExtContext): Promise { vscode.window.registerWebviewViewProvider(ReferenceLogViewProvider.viewType, ReferenceLogViewProvider.instance), showReferenceLog.register(), showLogs.register(), - showExploreAgentsView.register(), vscode.languages.registerCodeLensProvider( [...CodeWhispererConstants.platformLanguageIds], ReferenceInlineProvider.instance diff --git a/packages/core/src/codewhisperer/commands/basicCommands.ts b/packages/core/src/codewhisperer/commands/basicCommands.ts index a8c21b86ce2..ec1b5ae6e63 100644 --- a/packages/core/src/codewhisperer/commands/basicCommands.ts +++ b/packages/core/src/codewhisperer/commands/basicCommands.ts @@ -60,7 +60,6 @@ import { SecurityIssueProvider } from '../service/securityIssueProvider' import { CodeWhispererSettings } from '../util/codewhispererSettings' import { closeDiff, getPatchedCode } from '../../shared/utilities/diffUtils' import { insertCommentAboveLine } from '../../shared/utilities/commentUtils' -import { DefaultAmazonQAppInitContext } from '../../amazonq/apps/initContext' import path from 'path' import { UserWrittenCodeTracker } from '../tracker/userWrittenCodeTracker' import { parsePatch } from 'diff' @@ -173,20 +172,6 @@ export const showLogs = Commands.declare( } ) -export const showExploreAgentsView = Commands.declare( - { id: 'aws.amazonq.exploreAgents', compositeKey: { 1: 'source' } }, - () => async (_: VsCodeCommandArg, source: CodeWhispererSource) => { - if (_ !== placeholder) { - source = 'ellipsesMenu' - } - - DefaultAmazonQAppInitContext.instance.getAppsToWebViewMessagePublisher().publish({ - sender: 'amazonqCore', - command: 'showExploreAgentsView', - }) - } -) - export const showIntroduction = Commands.declare('aws.amazonq.introduction', () => async () => { void openUrl(vscode.Uri.parse(CodeWhispererConstants.learnMoreUriGeneral)) })