Skip to content

Commit b9347c6

Browse files
Revert "feat(amazonq): Activate Flare rerouting flag for agents, remove alternate entrypoint (#5856)" (#5891)
This reverts commit 6ab2a90. # Conflicts: # plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/model/ExtendedClientMetadata.kt
1 parent a99df55 commit b9347c6

File tree

6 files changed

+51
-26
lines changed

6 files changed

+51
-26
lines changed

.changes/next-release/feature-c8e68d82-96e3-4043-9fd5-4fa97fc00fe6.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/commands/ActionRegistrar.kt

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
@file:Suppress("BannedImports")
44
package software.aws.toolkits.jetbrains.services.cwc.commands
55

6+
import com.google.gson.Gson
67
import com.intellij.openapi.application.ApplicationManager
78
import com.intellij.openapi.project.Project
89
import kotlinx.coroutines.flow.MutableSharedFlow
@@ -16,6 +17,7 @@ import software.aws.toolkits.jetbrains.services.amazonq.lsp.model.aws.chat.SEND_
1617
import software.aws.toolkits.jetbrains.services.amazonq.lsp.model.aws.chat.SendToPromptParams
1718
import software.aws.toolkits.jetbrains.services.amazonq.lsp.model.aws.chat.TriggerType
1819
import software.aws.toolkits.jetbrains.services.amazonq.messages.AmazonQMessage
20+
import software.aws.toolkits.jetbrains.services.amazonqCodeTest.controller.TestCommandMessage
1921
import software.aws.toolkits.jetbrains.services.cwc.editor.context.ActiveFileContextExtractor
2022
import software.aws.toolkits.jetbrains.services.cwc.editor.context.ExtractionTriggerType
2123

@@ -26,21 +28,25 @@ class ActionRegistrar {
2628
val flow = _messages.asSharedFlow()
2729

2830
fun reportMessageClick(command: EditorContextCommand, project: Project) {
29-
// new agentic chat route
30-
ApplicationManager.getApplication().executeOnPooledThread {
31-
runBlocking {
32-
val contextExtractor = ActiveFileContextExtractor.create(fqnWebviewAdapter = null, project = project)
33-
val fileContext = contextExtractor.extractContextForTrigger(ExtractionTriggerType.ContextMenu)
34-
val codeSelection = "\n```\n${fileContext.focusAreaContext?.codeSelection?.trimIndent()?.trim()}\n```\n"
35-
var uiMessage: FlareUiMessage? = null
36-
if (command.verb != SEND_TO_PROMPT) {
37-
val params = GenericCommandParams(selection = codeSelection, triggerType = TriggerType.CONTEXT_MENU, genericCommand = command.name)
38-
uiMessage = FlareUiMessage(command = GENERIC_COMMAND, params = params)
39-
} else {
40-
val params = SendToPromptParams(selection = codeSelection, triggerType = TriggerType.CONTEXT_MENU)
41-
uiMessage = FlareUiMessage(command = SEND_TO_PROMPT, params = params)
31+
if (command == EditorContextCommand.GenerateUnitTests) {
32+
AsyncChatUiListener.notifyPartialMessageUpdate(project, Gson().toJson(TestCommandMessage()))
33+
} else {
34+
// new agentic chat route
35+
ApplicationManager.getApplication().executeOnPooledThread {
36+
runBlocking {
37+
val contextExtractor = ActiveFileContextExtractor.create(fqnWebviewAdapter = null, project = project)
38+
val fileContext = contextExtractor.extractContextForTrigger(ExtractionTriggerType.ContextMenu)
39+
val codeSelection = "\n```\n${fileContext.focusAreaContext?.codeSelection?.trimIndent()?.trim()}\n```\n"
40+
var uiMessage: FlareUiMessage? = null
41+
if (command.verb != SEND_TO_PROMPT) {
42+
val params = GenericCommandParams(selection = codeSelection, triggerType = TriggerType.CONTEXT_MENU, genericCommand = command.name)
43+
uiMessage = FlareUiMessage(command = GENERIC_COMMAND, params = params)
44+
} else {
45+
val params = SendToPromptParams(selection = codeSelection, triggerType = TriggerType.CONTEXT_MENU)
46+
uiMessage = FlareUiMessage(command = SEND_TO_PROMPT, params = params)
47+
}
48+
AsyncChatUiListener.notifyPartialMessageUpdate(project, uiMessage)
4249
}
43-
AsyncChatUiListener.notifyPartialMessageUpdate(project, uiMessage)
4450
}
4551
}
4652
}

plugins/amazonq/mynah-ui/src/mynah-ui/ui/quickActions/generator.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export class QuickActionGenerator {
3838

3939
const quickActionCommands = [
4040
{
41+
groupName: `Q Developer Agent for <b>Software Development</b>`,
4142
commands: [
4243
...(this.isFeatureDevEnabled
4344
? [
@@ -77,6 +78,11 @@ export class QuickActionGenerator {
7778
},
7879
]
7980
: []),
81+
],
82+
},
83+
{
84+
groupName: `Q Developer Agent for <b>Code Transformation</b>`,
85+
commands:[
8086
...(this.isCodeTransformEnabled
8187
? [
8288
{
@@ -87,7 +93,22 @@ export class QuickActionGenerator {
8793
]
8894
: []),
8995
],
90-
}
96+
},
97+
{
98+
groupName: 'Quick Actions',
99+
commands: [
100+
{
101+
command: '/help',
102+
icon: MynahIcons.HELP,
103+
description: 'Learn more about Amazon Q',
104+
},
105+
{
106+
command: '/clear',
107+
icon: MynahIcons.TRASH,
108+
description: 'Clear this session',
109+
},
110+
],
111+
},
91112
].filter((section) => section.commands.length > 0)
92113

93114
const commandUnavailability: Record<

plugins/amazonq/mynah-ui/src/mynah-ui/ui/quickActions/handler.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,14 @@ private handleDocCommand(chatPrompt: ChatPrompt, tabID: string, taskName: string
344344
this.connector.startTestGen(testTabId, realPromptText)
345345
return
346346
}
347-
347+
/**
348+
* right click -> generate test has no tab id
349+
* we have to manually create one if a testgen tab
350+
* wasn't previously created
351+
*/
352+
if (!tabID) {
353+
tabID = this.mynahUI?.updateStore('', {})
354+
}
348355
const affectedTabId: string | undefined = this.addTab(tabID)
349356

350357
// if there is no test tab, open a new one

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/flareChat/AwsServerCapabilitiesProvider.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ class AwsServerCapabilitiesProvider {
3434
),
3535
history = true,
3636
export = true,
37-
mcpServers = true,
38-
// Seems like this is the only way to bounce reroute back to the LSP?
39-
reroute = true,
37+
mcpServers = true
4038
)
4139
}
4240
}
@@ -50,7 +48,6 @@ data class ChatOptions(
5048
val history: Boolean,
5149
val export: Boolean,
5250
val mcpServers: Boolean,
53-
val reroute: Boolean,
5451
)
5552

5653
data class QuickActions(

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/model/ExtendedClientMetadata.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ data class DeveloperProfiles(
2525
val developerProfiles: Boolean,
2626
val mcp: Boolean,
2727
val pinnedContextEnabled: Boolean,
28-
val imageContextEnabled: Boolean,
2928
val reroute: Boolean,
3029
val workspaceFilePath: String?,
3130
)
@@ -68,7 +67,6 @@ fun createExtendedClientMetadata(project: Project): ExtendedClientMetadata {
6867
developerProfiles = true,
6968
mcp = true,
7069
pinnedContextEnabled = true,
71-
imageContextEnabled = true,
7270
reroute = true,
7371
workspaceFilePath = project.workspaceFile?.path,
7472
),

0 commit comments

Comments
 (0)