diff --git a/plugin/src/software/aws/toolkits/eclipse/amazonq/lsp/manager/LspConstants.java b/plugin/src/software/aws/toolkits/eclipse/amazonq/lsp/manager/LspConstants.java index c421ab53..364988e5 100644 --- a/plugin/src/software/aws/toolkits/eclipse/amazonq/lsp/manager/LspConstants.java +++ b/plugin/src/software/aws/toolkits/eclipse/amazonq/lsp/manager/LspConstants.java @@ -25,5 +25,5 @@ private LspConstants() { public static final String LSP_SUBDIRECTORY = "lsp"; public static final String AMAZONQ_LSP_SUBDIRECTORY = Paths.get(LSP_SUBDIRECTORY, "AmazonQ").toString(); - public static final VersionRange LSP_SUPPORTED_VERSION_RANGE = new VersionRange("[2.3.0, 2.3.10)"); + public static final VersionRange LSP_SUPPORTED_VERSION_RANGE = new VersionRange("[3.0.0, 3.0.10)"); } diff --git a/plugin/src/software/aws/toolkits/eclipse/amazonq/views/AmazonQChatViewActionHandler.java b/plugin/src/software/aws/toolkits/eclipse/amazonq/views/AmazonQChatViewActionHandler.java index 8c81ebd8..889f848d 100644 --- a/plugin/src/software/aws/toolkits/eclipse/amazonq/views/AmazonQChatViewActionHandler.java +++ b/plugin/src/software/aws/toolkits/eclipse/amazonq/views/AmazonQChatViewActionHandler.java @@ -2,7 +2,6 @@ package software.aws.toolkits.eclipse.amazonq.views; - import java.util.Arrays; import java.util.Optional; import java.util.concurrent.atomic.AtomicReference; @@ -24,6 +23,7 @@ import software.aws.toolkits.eclipse.amazonq.chat.models.CopyToClipboardParams; import software.aws.toolkits.eclipse.amazonq.chat.models.InfoLinkClickParams; import software.aws.toolkits.eclipse.amazonq.chat.models.InsertToCursorPositionParams; +import software.aws.toolkits.eclipse.amazonq.configuration.PluginStoreKeys; import software.aws.toolkits.eclipse.amazonq.exception.AmazonQPluginException; import software.aws.toolkits.eclipse.amazonq.lsp.auth.model.AuthFollowUpClickedParams; import software.aws.toolkits.eclipse.amazonq.lsp.auth.model.AuthFollowUpType; @@ -117,6 +117,9 @@ public final void handleCommand(final ParsedCommand parsedCommand, final Browser AuthFollowUpClickedParams authFollowUpClickedParams = jsonHandler.convertObject(params, AuthFollowUpClickedParams.class); handleAuthFollowUpClicked(authFollowUpClickedParams); break; + case DISCLAIMER_ACKNOWLEDGED: + Activator.getPluginStore().put(PluginStoreKeys.CHAT_DISCLAIMER_ACKNOWLEDGED, "true"); + break; default: throw new AmazonQPluginException("Unexpected command received from Amazon Q Chat: " + command.toString()); } diff --git a/plugin/src/software/aws/toolkits/eclipse/amazonq/views/AmazonQChatWebview.java b/plugin/src/software/aws/toolkits/eclipse/amazonq/views/AmazonQChatWebview.java index 0fe1fe9f..d2346ed9 100644 --- a/plugin/src/software/aws/toolkits/eclipse/amazonq/views/AmazonQChatWebview.java +++ b/plugin/src/software/aws/toolkits/eclipse/amazonq/views/AmazonQChatWebview.java @@ -18,6 +18,7 @@ import software.aws.toolkits.eclipse.amazonq.chat.ChatCommunicationManager; import software.aws.toolkits.eclipse.amazonq.chat.ChatStateManager; import software.aws.toolkits.eclipse.amazonq.chat.ChatTheme; +import software.aws.toolkits.eclipse.amazonq.configuration.PluginStoreKeys; import software.aws.toolkits.eclipse.amazonq.lsp.AwsServerCapabiltiesProvider; import software.aws.toolkits.eclipse.amazonq.lsp.auth.model.AuthState; import software.aws.toolkits.eclipse.amazonq.lsp.model.ChatOptions; @@ -223,6 +224,7 @@ private String generateCss() { private String generateJS(final String jsEntrypoint) { var chatQuickActionConfig = generateQuickActionConfig(); + var disclaimerAcknowledged = Activator.getPluginStore().get(PluginStoreKeys.CHAT_DISCLAIMER_ACKNOWLEDGED); return String.format(""" - """, jsEntrypoint, getWaitFunction(), chatQuickActionConfig); + """, jsEntrypoint, getWaitFunction(), chatQuickActionConfig, + disclaimerAcknowledged.equals("true")); } /* @@ -252,14 +258,13 @@ private String generateJS(final String jsEntrypoint) { private String generateQuickActionConfig() { return Optional.ofNullable(AwsServerCapabiltiesProvider.getInstance().getChatOptions()) .map(ChatOptions::quickActions).map(QuickActions::quickActionsCommandGroups) - .map(this::serializeQuickActionCommands).orElse(""); + .map(this::serializeQuickActionCommands).orElse("[]"); } private String serializeQuickActionCommands(final List quickActionCommands) { try { ObjectMapper mapper = ObjectMapperFactory.getInstance(); - String json = mapper.writeValueAsString(quickActionCommands); - return String.format("{\"quickActionCommands\": %s}", json); + return mapper.writeValueAsString(quickActionCommands); } catch (Exception e) { Activator.getLogger().warn("Error occurred when json serializing quick action commands", e); return ""; diff --git a/plugin/src/software/aws/toolkits/eclipse/amazonq/views/model/Command.java b/plugin/src/software/aws/toolkits/eclipse/amazonq/views/model/Command.java index ebf28e51..489944d3 100644 --- a/plugin/src/software/aws/toolkits/eclipse/amazonq/views/model/Command.java +++ b/plugin/src/software/aws/toolkits/eclipse/amazonq/views/model/Command.java @@ -24,6 +24,7 @@ public enum Command { CHAT_COPY_TO_CLIPBOARD("copyToClipboard"), CHAT_INSERT_TO_CURSOR_POSITION("insertToCursorPosition"), AUTH_FOLLOW_UP_CLICKED("authFollowUpClicked"), //Auth command handled in QChat webview + DISCLAIMER_ACKNOWLEDGED("disclaimerAcknowledged"), // Auth LOGIN_BUILDER_ID("loginBuilderId"),