Skip to content

Commit debeb41

Browse files
authored
fix: migration from /agents ux (aws#2248)
1 parent b140060 commit debeb41

File tree

4 files changed

+3
-214
lines changed

4 files changed

+3
-214
lines changed

chat-client/src/client/mynahUi.ts

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,7 @@ import {
6969
toMynahIcon,
7070
} from './utils'
7171
import { ChatHistory, ChatHistoryList } from './features/history'
72-
import {
73-
pairProgrammingModeOff,
74-
pairProgrammingModeOn,
75-
programmerModeCard,
76-
createRerouteCard,
77-
} from './texts/pairProgramming'
72+
import { pairProgrammingModeOff, pairProgrammingModeOn, programmerModeCard } from './texts/pairProgramming'
7873
import { ContextRule, RulesList } from './features/rules'
7974
import { getModelSelectionChatItem, modelUnavailableBanner, modelThrottledBanner } from './texts/modelSelection'
8075
import {
@@ -285,11 +280,6 @@ export const handleChatPrompt = (
285280
// For /doc command, don't show any prompt in UI
286281
const displayPrompt = isReroutedCommand && prompt.command === '/doc' ? '' : userPrompt
287282
initializeChatResponse(mynahUi, tabId, displayPrompt, agenticMode)
288-
289-
// If this is a rerouted command AND reroute feature is enabled, show the reroute card after the prompt
290-
if (isReroutedCommand && tabFactory?.isRerouteEnabled() && prompt.command) {
291-
mynahUi.addChatItem(tabId, createRerouteCard(prompt.command))
292-
}
293283
}
294284

295285
const initializeChatResponse = (mynahUi: MynahUI, tabId: string, userPrompt?: string, agenticMode?: boolean) => {
@@ -404,9 +394,6 @@ export const createMynahUi = (
404394
const defaultTabBarData = tabFactory.getDefaultTabData()
405395
const defaultTabConfig: Partial<MynahUIDataModel> = {
406396
quickActionCommands: defaultTabBarData.quickActionCommands,
407-
...(tabFactory.isRerouteEnabled()
408-
? { quickActionCommandsHeader: defaultTabBarData.quickActionCommandsHeader }
409-
: {}),
410397
tabBarButtons: defaultTabBarData.tabBarButtons,
411398
contextCommands: [
412399
...(contextCommandGroups || []),

chat-client/src/client/tabs/tabFactory.ts

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
MynahIcons,
55
MynahUIDataModel,
66
QuickActionCommandGroup,
7-
QuickActionCommandsHeader,
87
TabBarMainAction,
98
} from '@aws/mynah-ui'
109
import { disclaimerCard } from '../texts/disclaimer'
@@ -143,17 +142,6 @@ Select code & ask me to explain, debug or optimize it, or type \`/\` for quick a
143142
quickActionCommands: this.quickActionCommands,
144143
}
145144
: {}),
146-
...(this.reroute
147-
? {
148-
quickActionCommandsHeader: {
149-
status: 'warning',
150-
icon: MynahIcons.INFO,
151-
title: 'Q Developer agentic capabilities',
152-
description:
153-
"You can now ask Q directly in the chat to generate code, documentation, and unit tests. You don't need to explicitly use /dev, /test, /review or /doc",
154-
} as QuickActionCommandsHeader,
155-
}
156-
: {}),
157145
}
158146

159147
tabData.tabBarButtons = this.getTabBarButtons()
@@ -229,50 +217,4 @@ Select code & ask me to explain, debug or optimize it, or type \`/\` for quick a
229217

230218
return tabBarButtons.length ? tabBarButtons : undefined
231219
}
232-
233-
// Enhanced welcome messages block for non-agentic mode
234-
private getEnhancedWelcomeBlock() {
235-
return {
236-
text: '',
237-
options: [
238-
{
239-
pillText: 'Getting Started',
240-
prompt: 'What can Amazon Q help me with?',
241-
type: 'help',
242-
},
243-
],
244-
}
245-
}
246-
247-
// Agentic welcome messages block
248-
private getAgenticWelcomeBlock() {
249-
return {
250-
text: '',
251-
options: [
252-
{
253-
pillText: 'Getting Started',
254-
prompt: 'What can Amazon Q help me with?',
255-
type: 'help',
256-
},
257-
],
258-
}
259-
}
260-
261-
// Legacy welcome messages block
262-
private getWelcomeBlock() {
263-
return {
264-
text: 'Try Examples:',
265-
options: [
266-
{
267-
pillText: 'Explain selected code',
268-
prompt: 'Explain selected code',
269-
type: 'init-prompt',
270-
},
271-
{
272-
pillText: 'How can Amazon Q help me?',
273-
type: 'help',
274-
},
275-
],
276-
}
277-
}
278220
}
Lines changed: 1 addition & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
import * as assert from 'assert'
2-
import { ChatItemType, MynahIcons } from '@aws/mynah-ui'
2+
import { ChatItemType } from '@aws/mynah-ui'
33
import {
44
programmerModeCard,
55
pairProgrammingPromptInput,
66
pairProgrammingModeOn,
77
pairProgrammingModeOff,
8-
testRerouteCard,
9-
docRerouteCard,
10-
devRerouteCard,
11-
createRerouteCard,
128
} from './pairProgramming'
139

1410
describe('pairProgramming', () => {
@@ -56,67 +52,4 @@ describe('pairProgramming', () => {
5652
assert.equal(pairProgrammingModeOff.body, 'Agentic coding - OFF')
5753
})
5854
})
59-
60-
describe('testRerouteCard', () => {
61-
it('has correct properties', () => {
62-
assert.equal(testRerouteCard.type, ChatItemType.ANSWER)
63-
assert.equal(testRerouteCard.border, true)
64-
assert.equal(testRerouteCard.header?.padding, true)
65-
assert.equal(testRerouteCard.header?.iconForegroundStatus, 'warning')
66-
assert.equal(testRerouteCard.header?.icon, MynahIcons.INFO)
67-
assert.ok(testRerouteCard.header?.body?.includes('generate unit tests'))
68-
assert.ok(testRerouteCard.body?.includes("You don't need to explicitly use /test"))
69-
})
70-
})
71-
72-
describe('docRerouteCard', () => {
73-
it('has correct properties', () => {
74-
assert.equal(docRerouteCard.type, ChatItemType.ANSWER)
75-
assert.equal(docRerouteCard.border, true)
76-
assert.equal(docRerouteCard.header?.padding, true)
77-
assert.equal(docRerouteCard.header?.iconForegroundStatus, 'warning')
78-
assert.equal(docRerouteCard.header?.icon, MynahIcons.INFO)
79-
assert.ok(docRerouteCard.header?.body?.includes('generate documentation'))
80-
assert.ok(docRerouteCard.body?.includes("You don't need to explicitly use /doc"))
81-
})
82-
})
83-
84-
describe('devRerouteCard', () => {
85-
it('has correct properties', () => {
86-
assert.equal(devRerouteCard.type, ChatItemType.ANSWER)
87-
assert.equal(devRerouteCard.border, true)
88-
assert.equal(devRerouteCard.header?.padding, true)
89-
assert.equal(devRerouteCard.header?.iconForegroundStatus, 'warning')
90-
assert.equal(devRerouteCard.header?.icon, MynahIcons.INFO)
91-
assert.ok(devRerouteCard.header?.body?.includes('generate code'))
92-
assert.ok(devRerouteCard.body?.includes("You don't need to explicitly use /dev"))
93-
})
94-
})
95-
96-
describe('createRerouteCard', () => {
97-
it('returns testRerouteCard for /test command', () => {
98-
const result = createRerouteCard('/test')
99-
assert.deepEqual(result, testRerouteCard)
100-
})
101-
102-
it('returns docRerouteCard for /doc command', () => {
103-
const result = createRerouteCard('/doc')
104-
assert.deepEqual(result, docRerouteCard)
105-
})
106-
107-
it('returns devRerouteCard for /dev command', () => {
108-
const result = createRerouteCard('/dev')
109-
assert.deepEqual(result, devRerouteCard)
110-
})
111-
112-
it('returns devRerouteCard for unknown command', () => {
113-
const result = createRerouteCard('/unknown')
114-
assert.deepEqual(result, devRerouteCard)
115-
})
116-
117-
it('returns devRerouteCard for empty string', () => {
118-
const result = createRerouteCard('')
119-
assert.deepEqual(result, devRerouteCard)
120-
})
121-
})
12255
})
Lines changed: 1 addition & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ChatItem, ChatItemFormItem, ChatItemType, MynahIcons } from '@aws/mynah-ui'
1+
import { ChatItem, ChatItemFormItem, ChatItemType } from '@aws/mynah-ui'
22

33
export const programmerModeCard: ChatItem = {
44
type: ChatItemType.ANSWER,
@@ -36,76 +36,3 @@ export const pairProgrammingModeOff: ChatItem = {
3636
fullWidth: true,
3737
body: 'Agentic coding - OFF',
3838
}
39-
40-
export const testRerouteCard: ChatItem = {
41-
type: ChatItemType.ANSWER,
42-
border: true,
43-
header: {
44-
padding: true,
45-
iconForegroundStatus: 'warning',
46-
icon: MynahIcons.INFO,
47-
body: 'You can now ask to generate unit tests directly in the chat.',
48-
},
49-
body: `You don't need to explicitly use /test. We've redirected your request to chat.
50-
Ask me to do things like:
51-
• Add unit tests for highlighted functions in my active file
52-
• Generate tests for null and empty inputs in my project`,
53-
}
54-
55-
export const docRerouteCard: ChatItem = {
56-
type: ChatItemType.ANSWER,
57-
border: true,
58-
header: {
59-
padding: true,
60-
iconForegroundStatus: 'warning',
61-
icon: MynahIcons.INFO,
62-
body: 'You can now ask to generate documentation directly in the chat.',
63-
},
64-
body: `You don't need to explicitly use /doc. We've redirected your request to chat.`,
65-
}
66-
67-
export const devRerouteCard: ChatItem = {
68-
type: ChatItemType.ANSWER,
69-
border: true,
70-
header: {
71-
padding: true,
72-
iconForegroundStatus: 'warning',
73-
icon: MynahIcons.INFO,
74-
body: 'You can now ask to generate code directly in the chat.',
75-
},
76-
body: `You don't need to explicitly use /dev. We've redirected your request to chat.
77-
Ask me to do things like:
78-
1. Create a project
79-
2. Add a feature
80-
3. Modify your files`,
81-
}
82-
83-
export const reviewRerouteCard: ChatItem = {
84-
type: ChatItemType.ANSWER,
85-
border: true,
86-
header: {
87-
padding: true,
88-
iconForegroundStatus: 'warning',
89-
icon: MynahIcons.INFO,
90-
body: 'You can now ask to run code reviews directly in the chat.',
91-
},
92-
body: `You don't need to explicitly use /review. We've redirected your request to chat.
93-
Ask me to do things like:
94-
• Perform a code review of uncommitted changes in my active file
95-
• Perform a code review of my active file`,
96-
}
97-
98-
export const createRerouteCard = (command: string): ChatItem => {
99-
switch (command) {
100-
case '/test':
101-
return testRerouteCard
102-
case '/doc':
103-
return docRerouteCard
104-
case '/dev':
105-
return devRerouteCard
106-
case '/review':
107-
return reviewRerouteCard
108-
default:
109-
return devRerouteCard // Default fallback
110-
}
111-
}

0 commit comments

Comments
 (0)