Skip to content

Commit dbc01c2

Browse files
authored
Merge branch 'aws:main' into feature/extension
2 parents b8e84cc + 5003e6d commit dbc01c2

File tree

26 files changed

+1100
-218
lines changed

26 files changed

+1100
-218
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type" : "bugfix",
3+
"description" : "Fix issue with competing SDK proxy configuration (#4279)"
4+
}

.github/workflows/prerelease.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ jobs:
9595
java-version: '17'
9696
- name: Generate artifact
9797
run: |
98-
./gradlew -PideProfileName=${{ matrix.supported_versions }} :plugin-amazonq:buildPlugin --exclude-task buildResharperPlugin
98+
./gradlew -PideProfileName=${{ matrix.supported_versions }} :plugin-amazonq:buildPlugin
9999
- name: Upload artifact
100100
uses: actions/upload-artifact@v4
101101
with:

buildSrc/src/main/kotlin/software/aws/toolkits/gradle/intellij/IdeVersions.kt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -107,20 +107,20 @@ object IdeVersions {
107107
),
108108
community = ProductProfile(
109109
sdkFlavor = IdeFlavor.IC,
110-
sdkVersion = "241.14494-EAP-CANDIDATE-SNAPSHOT",
110+
sdkVersion = "2024.1",
111111
plugins = commonPlugins + listOf(
112112
"java",
113113
"com.intellij.gradle",
114114
"org.jetbrains.idea.maven",
115115
// transitive for python
116-
"org.toml.lang:241.14494.33",
117-
"PythonCore:241.14494.17",
118-
"Docker:241.14494.28"
116+
"org.toml.lang:241.14494.150",
117+
"PythonCore:241.14494.240",
118+
"Docker:241.14494.251"
119119
)
120120
),
121121
ultimate = ProductProfile(
122122
sdkFlavor = IdeFlavor.IU,
123-
sdkVersion = "241.14494-EAP-CANDIDATE-SNAPSHOT",
123+
sdkVersion = "2024.1",
124124
plugins = commonPlugins + listOf(
125125
"JavaScript",
126126
// Transitive dependency needed for javascript
@@ -130,21 +130,21 @@ object IdeVersions {
130130
"com.intellij.database",
131131
"com.jetbrains.codeWithMe",
132132
// transitive for python
133-
"org.toml.lang:241.14494.33",
134-
"Pythonid:241.14494.17",
135-
"org.jetbrains.plugins.go:241.14494.17",
133+
"org.toml.lang:241.14494.150",
134+
"Pythonid:241.14494.314",
135+
"org.jetbrains.plugins.go:241.14494.240",
136136
// https://github.com/JetBrains/gradle-intellij-plugin/issues/1056
137137
"org.intellij.intelliLang"
138138
)
139139
),
140140
rider = RiderProfile(
141-
sdkVersion = "2024.1-EAP8-SNAPSHOT",
141+
sdkVersion = "2024.1",
142142
plugins = commonPlugins + listOf(
143143
"rider-plugins-appender" // Workaround for https://youtrack.jetbrains.com/issue/IDEA-179607
144144
),
145145
netFrameworkTarget = "net472",
146146
rdGenVersion = "2024.1.1",
147-
nugetVersion = "2024.1.0-eap08"
147+
nugetVersion = "2024.1.0"
148148
)
149149
),
150150

gradle/libs.versions.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apache-commons-collections = "4.4"
33
apache-commons-io = "2.16.0"
44
assertJ = "3.20.2" # Upgrading leads to SAM errors: https://youtrack.jetbrains.com/issue/KT-17765
55
# match with <root>/settings.gradle.kts
6-
awsSdk = "2.21.33"
6+
awsSdk = "2.25.32"
77
commonmark = "0.17.1"
88
detekt = "1.23.6"
99
intellijGradle = "1.17.3"
@@ -12,22 +12,22 @@ jackson = "2.16.1"
1212
jacoco = "0.8.11"
1313
jgit = "6.5.0.202303070854-r"
1414
junit4 = "4.13.2"
15-
junit5 = "5.10.1"
15+
junit5 = "5.10.2"
1616
# https://plugins.jetbrains.com/docs/intellij/kotlin.html#adding-kotlin-support
1717
# https://kotlinlang.org/docs/releases.html#release-details
1818
kotlin = "1.9.23"
1919
# set in <root>/settings.gradle.kts
2020
kotlinCoroutines = "1.7.3"
2121
mockito = "5.10.0"
2222
mockitoKotlin = "5.2.1"
23-
mockk = "1.13.8"
23+
mockk = "1.13.10"
2424
node-gradle = "7.0.1"
2525
telemetryGenerator = "1.0.201"
2626
testLogger = "4.0.0"
2727
testRetry = "1.5.2"
2828
# test-only; platform provides slf4j transitively at runtime. <233, 1.7.36; >=233, 2.0.9
2929
slf4j = "2.0.9"
30-
sshd = "2.11.0"
30+
sshd = "2.12.1"
3131
wiremock = "3.3.1"
3232
undercouch-download = "5.2.1"
3333
zjsonpatch = "0.4.16"

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/auth/AuthController.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ class AuthController {
2828
val connectionState = checkBearerConnectionValidity(project, BearerTokenFeatureSet.Q)
2929
val codeWhispererState = checkBearerConnectionValidity(project, BearerTokenFeatureSet.CODEWHISPERER)
3030

31-
// CW chat is enabled for Builder and IDC users, Amazon Q is only valid for IDC users
31+
// CW chat is enabled for Builder and IDC users, same for Amazon Q
3232
return AuthNeededStates(
3333
chat = getAuthNeededState(connectionState, codeWhispererState),
34-
amazonQ = getAuthNeededState(connectionState, codeWhispererState, true)
34+
amazonQ = getAuthNeededState(connectionState, codeWhispererState)
3535
)
3636
}
3737

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqFeatureDev/auth/FeatureDevAuthUtils.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ import software.aws.toolkits.jetbrains.core.gettingstarted.editor.checkBearerCon
1111

1212
fun isFeatureDevAvailable(project: Project): Boolean {
1313
val connection = checkBearerConnectionValidity(project, BearerTokenFeatureSet.Q)
14-
return connection.connectionType == ActiveConnectionType.IAM_IDC && connection is ActiveConnection.ValidBearer
14+
return (connection.connectionType == ActiveConnectionType.IAM_IDC || connection.connectionType == ActiveConnectionType.BUILDER_ID) &&
15+
connection is ActiveConnection.ValidBearer
1516
}

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqFeatureDev/controller/FeatureDevController.kt

Lines changed: 15 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import com.intellij.diff.contents.EmptyContent
99
import com.intellij.diff.requests.SimpleDiffRequest
1010
import com.intellij.diff.util.DiffUserDataKeys
1111
import com.intellij.ide.BrowserUtil
12-
import com.intellij.notification.NotificationAction
1312
import com.intellij.openapi.application.runInEdt
1413
import com.intellij.openapi.command.WriteCommandAction
1514
import com.intellij.openapi.editor.Caret
@@ -49,19 +48,19 @@ import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.messages.sendA
4948
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.messages.sendAuthNeededException
5049
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.messages.sendAuthenticationInProgressMessage
5150
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.messages.sendChatInputEnabledMessage
52-
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.messages.sendCodeResult
5351
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.messages.sendError
5452
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.messages.sendSystemPrompt
5553
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.messages.sendUpdatePlaceholder
54+
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.messages.updateFileComponent
5655
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.session.DeletedFileInfo
5756
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.session.NewFileZipInfo
5857
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.session.PrepareCodeGenerationState
5958
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.session.Session
6059
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.session.SessionStatePhase
6160
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.storage.ChatSessionStorage
61+
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.util.getFollowUpOptions
6262
import software.aws.toolkits.jetbrains.services.cwc.messages.CodeReference
6363
import software.aws.toolkits.jetbrains.ui.feedback.FeatureDevFeedbackDialog
64-
import software.aws.toolkits.jetbrains.utils.notifyInfo
6564
import software.aws.toolkits.resources.message
6665
import software.aws.toolkits.telemetry.AmazonqTelemetry
6766
import java.util.UUID
@@ -72,8 +71,8 @@ class FeatureDevController(
7271
private val authController: AuthController = AuthController()
7372
) : InboundAppMessagesHandler {
7473

75-
private val messenger = context.messagesFromAppToUi
76-
private val toolWindow = ToolWindowManager.getInstance(context.project).getToolWindow(AmazonQToolWindowFactory.WINDOW_ID)
74+
val messenger = context.messagesFromAppToUi
75+
val toolWindow = ToolWindowManager.getInstance(context.project).getToolWindow(AmazonQToolWindowFactory.WINDOW_ID)
7776

7877
override suspend fun processPromptChatMessage(message: IncomingFeatureDevMessage.ChatPrompt) {
7978
handleChat(
@@ -225,12 +224,7 @@ class FeatureDevController(
225224
filePaths.find { it.zipFilePath == fileToUpdate }?.let { it.rejected = !it.rejected }
226225
deletedFiles.find { it.zipFilePath == fileToUpdate }?.let { it.rejected = !it.rejected }
227226

228-
session.updateFilesPaths(
229-
messenger = messenger,
230-
tabId = message.tabId,
231-
filePaths = filePaths,
232-
deletedFiles = deletedFiles
233-
)
227+
messenger.updateFileComponent(message.tabId, filePaths, deletedFiles)
234228
}
235229

236230
private suspend fun newTabOpened(tabId: String) {
@@ -292,13 +286,18 @@ class FeatureDevController(
292286
references = state.references
293287
}
294288
}
289+
295290
AmazonqTelemetry.isAcceptedCodeChanges(
296-
project = null,
297291
amazonqNumberOfFilesAccepted = (filePaths.filterNot { it.rejected }.size + deletedFiles.filterNot { it.rejected }.size) * 1.0,
298292
amazonqConversationId = session.conversationId,
299293
enabled = true
300294
)
301-
session.insertChanges(filePaths = filePaths, deletedFiles = deletedFiles, references = references)
295+
296+
session.insertChanges(
297+
filePaths = filePaths.filterNot { it.rejected },
298+
deletedFiles = deletedFiles.filterNot { it.rejected },
299+
references = references
300+
)
302301

303302
messenger.sendAnswer(
304303
tabId = tabId,
@@ -502,124 +501,6 @@ class FeatureDevController(
502501
messenger.sendAsyncEventProgress(tabId = tabId, inProgress = false)
503502
}
504503

505-
private suspend fun onCodeGeneration(session: Session, message: String, tabId: String) {
506-
messenger.sendAsyncEventProgress(
507-
tabId = tabId,
508-
inProgress = true,
509-
message = message("amazonqFeatureDev.chat_message.start_code_generation"),
510-
)
511-
512-
try {
513-
messenger.sendAnswer(
514-
tabId = tabId,
515-
message = message("amazonqFeatureDev.chat_message.requesting_changes"),
516-
messageType = FeatureDevMessageType.AnswerStream,
517-
)
518-
519-
messenger.sendUpdatePlaceholder(tabId = tabId, newPlaceholder = message("amazonqFeatureDev.placeholder.generating_code"))
520-
521-
session.send(message) // Trigger code generation
522-
523-
val state = session.sessionState
524-
525-
var filePaths: List<NewFileZipInfo> = emptyList()
526-
var deletedFiles: List<DeletedFileInfo> = emptyList()
527-
var references: List<CodeReference> = emptyList()
528-
var uploadId = ""
529-
530-
when (state) {
531-
is PrepareCodeGenerationState -> {
532-
filePaths = state.filePaths
533-
deletedFiles = state.deletedFiles
534-
references = state.references
535-
uploadId = state.uploadId
536-
}
537-
}
538-
539-
// Atm this is the only possible path as codegen is mocked to return empty.
540-
if (filePaths.size or deletedFiles.size == 0) {
541-
messenger.sendAnswer(
542-
tabId = tabId,
543-
messageType = FeatureDevMessageType.Answer,
544-
message = message("amazonqFeatureDev.code_generation.no_file_changes")
545-
)
546-
messenger.sendSystemPrompt(
547-
tabId = tabId,
548-
followUp = if (retriesRemaining(session) > 0) {
549-
listOf(
550-
FollowUp(
551-
pillText = message("amazonqFeatureDev.follow_up.retry"),
552-
type = FollowUpTypes.RETRY,
553-
status = FollowUpStatusType.Warning
554-
)
555-
)
556-
} else {
557-
emptyList()
558-
}
559-
)
560-
messenger.sendChatInputEnabledMessage(tabId = tabId, enabled = false) // Lock chat input until retry is clicked.
561-
return
562-
}
563-
564-
messenger.sendCodeResult(tabId = tabId, uploadId = uploadId, filePaths = filePaths, deletedFiles = deletedFiles, references = references)
565-
566-
messenger.sendSystemPrompt(tabId = tabId, followUp = getFollowUpOptions(session.sessionState.phase, interactionSucceeded = true))
567-
568-
messenger.sendUpdatePlaceholder(tabId = tabId, newPlaceholder = message("amazonqFeatureDev.placeholder.after_code_generation"))
569-
} finally {
570-
messenger.sendAsyncEventProgress(tabId = tabId, inProgress = false) // Finish processing the event
571-
messenger.sendChatInputEnabledMessage(tabId = tabId, enabled = false) // Lock chat input until a follow-up is clicked.
572-
573-
if (toolWindow != null && !toolWindow.isVisible) {
574-
notifyInfo(
575-
title = message("amazonqFeatureDev.code_generation.notification_title"),
576-
content = message("amazonqFeatureDev.code_generation.notification_message"),
577-
project = context.project,
578-
notificationActions = listOf(openChatNotificationAction())
579-
)
580-
}
581-
}
582-
}
583-
584-
private fun openChatNotificationAction() = NotificationAction.createSimple(message("amazonqFeatureDev.code_generation.notification_open_link")) {
585-
toolWindow?.show()
586-
}
587-
588-
private fun getFollowUpOptions(phase: SessionStatePhase?, interactionSucceeded: Boolean): List<FollowUp> {
589-
when (phase) {
590-
SessionStatePhase.APPROACH -> {
591-
return when (interactionSucceeded) {
592-
true -> listOf(
593-
FollowUp(
594-
pillText = message("amazonqFeatureDev.follow_up.generate_code"),
595-
type = FollowUpTypes.GENERATE_CODE,
596-
status = FollowUpStatusType.Info,
597-
)
598-
)
599-
600-
false -> emptyList()
601-
}
602-
}
603-
SessionStatePhase.CODEGEN -> {
604-
return listOf(
605-
FollowUp(
606-
pillText = message("amazonqFeatureDev.follow_up.insert_code"),
607-
type = FollowUpTypes.INSERT_CODE,
608-
icon = FollowUpIcons.Ok,
609-
status = FollowUpStatusType.Success
610-
),
611-
FollowUp(
612-
pillText = message("amazonqFeatureDev.follow_up.provide_feedback_and_regenerate"),
613-
type = FollowUpTypes.PROVIDE_FEEDBACK_AND_REGENERATE_CODE,
614-
icon = FollowUpIcons.Refresh,
615-
status = FollowUpStatusType.Info
616-
)
617-
)
618-
}
619-
else -> return emptyList()
620-
}
621-
}
622-
623504
private suspend fun retryRequests(tabId: String) {
624505
var session: Session? = null
625506
try {
@@ -728,9 +609,11 @@ class FeatureDevController(
728609
}
729610
}
730611

612+
fun getProject() = context.project
613+
731614
private fun getSessionInfo(tabId: String) = chatSessionStorage.getSession(tabId, context.project)
732615

733-
private fun retriesRemaining(session: Session?): Int = session?.retries ?: DEFAULT_RETRY_LIMIT
616+
fun retriesRemaining(session: Session?): Int = session?.retries ?: DEFAULT_RETRY_LIMIT
734617

735618
companion object {
736619
private val logger = getLogger<FeatureDevController>()

0 commit comments

Comments
 (0)