Skip to content

Commit b76a20e

Browse files
Revert "Revert "feat(amazonq): Activate Flare rerouting flag for agents, remove alternate entrypoint (#5856)" (#5891)" (#5893)
This reverts commit b9347c6. Co-authored-by: Bryce Ito <[email protected]>
1 parent 8f02eba commit b76a20e

File tree

6 files changed

+26
-51
lines changed

6 files changed

+26
-51
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type" : "feature",
3+
"description" : "Amazon Q /test, /doc, and /dev capabilities integrated into Agentic coding."
4+
}

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

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

6-
import com.google.gson.Gson
76
import com.intellij.openapi.application.ApplicationManager
87
import com.intellij.openapi.project.Project
98
import kotlinx.coroutines.flow.MutableSharedFlow
@@ -17,7 +16,6 @@ import software.aws.toolkits.jetbrains.services.amazonq.lsp.model.aws.chat.SEND_
1716
import software.aws.toolkits.jetbrains.services.amazonq.lsp.model.aws.chat.SendToPromptParams
1817
import software.aws.toolkits.jetbrains.services.amazonq.lsp.model.aws.chat.TriggerType
1918
import software.aws.toolkits.jetbrains.services.amazonq.messages.AmazonQMessage
20-
import software.aws.toolkits.jetbrains.services.amazonqCodeTest.controller.TestCommandMessage
2119
import software.aws.toolkits.jetbrains.services.cwc.editor.context.ActiveFileContextExtractor
2220
import software.aws.toolkits.jetbrains.services.cwc.editor.context.ExtractionTriggerType
2321

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

3028
fun reportMessageClick(command: EditorContextCommand, project: Project) {
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)
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)
4942
}
43+
AsyncChatUiListener.notifyPartialMessageUpdate(project, uiMessage)
5044
}
5145
}
5246
}

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

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

3939
const quickActionCommands = [
4040
{
41-
groupName: `Q Developer Agent for <b>Software Development</b>`,
4241
commands: [
4342
...(this.isFeatureDevEnabled
4443
? [
@@ -78,11 +77,6 @@ export class QuickActionGenerator {
7877
},
7978
]
8079
: []),
81-
],
82-
},
83-
{
84-
groupName: `Q Developer Agent for <b>Code Transformation</b>`,
85-
commands:[
8680
...(this.isCodeTransformEnabled
8781
? [
8882
{
@@ -93,22 +87,7 @@ export class QuickActionGenerator {
9387
]
9488
: []),
9589
],
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-
},
90+
}
11291
].filter((section) => section.commands.length > 0)
11392

11493
const commandUnavailability: Record<

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

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -344,14 +344,7 @@ private handleDocCommand(chatPrompt: ChatPrompt, tabID: string, taskName: string
344344
this.connector.startTestGen(testTabId, realPromptText)
345345
return
346346
}
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-
}
347+
355348
const affectedTabId: string | undefined = this.addTab(tabID)
356349

357350
// 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: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ class AwsServerCapabilitiesProvider {
3434
),
3535
history = true,
3636
export = true,
37-
mcpServers = true
37+
mcpServers = true,
38+
// Seems like this is the only way to bounce reroute back to the LSP?
39+
reroute = true,
3840
)
3941
}
4042
}
@@ -48,6 +50,7 @@ data class ChatOptions(
4850
val history: Boolean,
4951
val export: Boolean,
5052
val mcpServers: Boolean,
53+
val reroute: Boolean,
5154
)
5255

5356
data class QuickActions(

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ data class DeveloperProfiles(
2525
val developerProfiles: Boolean,
2626
val mcp: Boolean,
2727
val pinnedContextEnabled: Boolean,
28+
val imageContextEnabled: Boolean,
2829
val reroute: Boolean,
2930
val workspaceFilePath: String?,
3031
)
@@ -67,6 +68,7 @@ fun createExtendedClientMetadata(project: Project): ExtendedClientMetadata {
6768
developerProfiles = true,
6869
mcp = true,
6970
pinnedContextEnabled = true,
71+
imageContextEnabled = true,
7072
reroute = true,
7173
workspaceFilePath = project.workspaceFile?.path,
7274
),

0 commit comments

Comments
 (0)