Merge pull request #3846 from continuedev/nate/jb-onboarding-flow

jb-onboarding flow
This commit is contained in:
Nate Sesti 2025-02-11 22:58:25 -08:00 • committed by GitHub
commit a8a5841d27
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 70 additions and 30 deletions

View file

@ -48,7 +48,7 @@
"@aws-sdk/client-sagemaker-runtime": "^3.621.0",
"@aws-sdk/credential-providers": "^3.620.1",
"@continuedev/config-types": "^1.0.13",
"@continuedev/config-yaml": "^1.0.26",
"@continuedev/config-yaml": "^1.0.28",
"@continuedev/fetch": "^1.0.4",
"@continuedev/llm-info": "^1.0.2",
"@continuedev/openai-adapters": "^1.0.10",

View file

@ -35,7 +35,8 @@ async function modelConfigToBaseLLM(
return undefined;
}
const usingContinueProxy = model.provider === "continue-proxy";
const usingContinueProxy =
platformConfigMetadata && model.provider === "continue-proxy";
const modelName = usingContinueProxy
? getContinueProxyModelName(
platformConfigMetadata!.ownerSlug,

View file

@ -4,13 +4,14 @@ import { getControlPlaneEnv } from "../env";
export async function getAuthUrlForTokenPage(
ideSettingsPromise: Promise<IdeSettings>,
useOnboarding: boolean,
): Promise<string> {
const env = await getControlPlaneEnv(ideSettingsPromise);
const url = new URL("https://api.workos.com/user_management/authorize");
const params = {
response_type: "code",
client_id: env.WORKOS_CLIENT_ID,
redirect_uri: `${env.APP_URL}tokens/callback`,
redirect_uri: `${env.APP_URL}tokens/${useOnboarding ? "onboarding-" : ""}callback`,
// redirect_uri: "http://localhost:3000/tokens/callback",
state: uuidv4(),
provider: "authkit",

View file

@ -921,7 +921,10 @@ export class Core {
);
});
on("auth/getAuthUrl", async (msg) => {
const url = await getAuthUrlForTokenPage(ideSettingsPromise);
const url = await getAuthUrlForTokenPage(
ideSettingsPromise,
msg.data.useOnboarding,
);
return { url };
});

View file

@ -186,7 +186,7 @@ export type ToCoreFromIdeOrWebviewProtocol = {
"profiles/switch": [{ id: string }, undefined];
"auth/getAuthUrl": [undefined, { url: string }];
"auth/getAuthUrl": [{ useOnboarding: boolean }, { url: string }];
"tools/call": [
{ toolCall: ToolCall; selectedModelTitle: string },
{ contextItems: ContextItem[] },

View file

@ -3,7 +3,7 @@ pluginGroup=com.github.continuedev.continueintellijextension
pluginName=continue-intellij-extension
pluginRepositoryUrl=https://github.com/continuedev/continue
# SemVer format -> https://semver.org
pluginVersion=0.0.88
pluginVersion=0.0.89
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
pluginSinceBuild=223
# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension

View file

@ -204,7 +204,7 @@ class ContinuePluginStartupActivity : StartupActivity, DumbAware {
connection.subscribe(AuthListener.TOPIC, object : AuthListener {
override fun startAuthFlow() {
authService.startAuthFlow(project)
authService.startAuthFlow(project, false)
}
override fun handleUpdatedSessionInfo(sessionInfo: ControlPlaneSessionInfo?) {

View file

@ -7,7 +7,8 @@ import javax.swing.JComponent
import javax.swing.JPanel
import java.awt.BorderLayout
class ContinueAuthDialog(private val onTokenEntered: (String) -> Unit) : DialogWrapper(true) {
class ContinueAuthDialog(private val useOnboarding: Boolean, private val onTokenEntered: (String) -> Unit) :
DialogWrapper(true) {
private val tokenField = JBTextField()
init {
@ -17,7 +18,9 @@ class ContinueAuthDialog(private val onTokenEntered: (String) -> Unit) : DialogW
override fun createCenterPanel(): JComponent {
val panel = JPanel(BorderLayout())
panel.add(JBLabel("Please enter your Continue authentication token:"), BorderLayout.NORTH)
val message =
if (useOnboarding) "After onboarding you will be shown an authentication token. Please enter it here:" else "Please enter your Continue authentication token:"
panel.add(JBLabel(message), BorderLayout.NORTH)
panel.add(tokenField, BorderLayout.CENTER)
return panel
}

View file

@ -33,8 +33,18 @@ class ContinueAuthService {
private const val REFRESH_TOKEN_KEY = "ContinueRefreshToken"
private const val ACCOUNT_ID_KEY = "ContinueAccountId"
private const val ACCOUNT_LABEL_KEY = "ContinueAccountLabel"
private const val CONTROL_PLANE_URL = "https://control-plane-api-service-i3dqylpbqa-uc.a.run.app"
// private const val CONTROL_PLANE_URL = "http://localhost:3001"
}
private fun getControlPlaneUrl(): String {
val env = service<ContinueExtensionSettings>().continueState.continueTestEnvironment;
when (env) {
"none" -> return "https://control-plane-api-service-i3dqylpbqa-uc.a.run.app"
"local" -> return "http://localhost:3001"
"production" -> return "https://api.continue.dev"
"test" -> return "https://api-test.continue.dev"
}
return "https://control-plane-api-service-i3dqylpbqa-uc.a.run.app"
}
init {
@ -44,13 +54,13 @@ class ContinueAuthService {
}
}
fun startAuthFlow(project: Project) {
fun startAuthFlow(project: Project, useOnboarding: Boolean) {
// Open login page
openSignInPage(project)
openSignInPage(project, useOnboarding)
// Open a dialog where the user should paste their sign-in token
ApplicationManager.getApplication().invokeLater {
val dialog = ContinueAuthDialog() { token ->
val dialog = ContinueAuthDialog(useOnboarding) { token ->
// Store the token
updateRefreshToken(token)
}
@ -78,10 +88,12 @@ class ContinueAuthService {
val lastName = user?.get("lastName") as? String
val label = "$firstName $lastName"
val id = user?.get("id") as? String
val email = user?.get("email") as? String
// Persist the session info
setRefreshToken(refreshToken!!)
val sessionInfo = ControlPlaneSessionInfo(accessToken!!, ControlPlaneSessionInfo.Account(id!!, label))
val sessionInfo =
ControlPlaneSessionInfo(accessToken!!, ControlPlaneSessionInfo.Account(email!!, label))
setControlPlaneSessionInfo(sessionInfo)
// Notify listeners
@ -111,7 +123,7 @@ class ContinueAuthService {
private suspend fun refreshToken(refreshToken: String) = withContext(Dispatchers.IO) {
val client = OkHttpClient()
val url = URL(CONTROL_PLANE_URL).toURI().resolve("/auth/refresh").toURL()
val url = URL(getControlPlaneUrl()).toURI().resolve("/auth/refresh").toURL()
val jsonBody = mapOf("refreshToken" to refreshToken)
val jsonString = Gson().toJson(jsonBody)
val requestBody = jsonString.toRequestBody("application/json".toMediaType())
@ -132,9 +144,13 @@ class ContinueAuthService {
}
private fun openSignInPage(project: Project) {
private fun openSignInPage(project: Project, useOnboarding: Boolean) {
val coreMessenger = project.service<ContinuePluginService>().coreMessenger
coreMessenger?.request("auth/getAuthUrl", null, null) { response ->
coreMessenger?.request(
"auth/getAuthUrl", mapOf(
"useOnboarding" to useOnboarding
), null
) { response ->
val authUrl = ((response as? Map<*, *>)?.get("content") as? Map<*, *>)?.get("url") as? String
if (authUrl != null) {
// Open the auth URL in the browser
@ -208,7 +224,7 @@ class ContinueAuthService {
val accountId = getAccountId()
val accountLabel = getAccountLabel()
return if (accessToken != null && accountId != null && accountLabel != null) {
return if ((accessToken != null && accessToken != "") && accountId != null && accountLabel != null) {
ControlPlaneSessionInfo(
accessToken = accessToken,
account = ControlPlaneSessionInfo.Account(

View file

@ -41,6 +41,7 @@ class MessageTypes {
"logoutOfControlPlane",
"getTerminalContents",
"showToast",
"openUrl"
)
// Note: If updating these values, make a corresponding update in

View file

@ -86,7 +86,9 @@ class GetTheme {
"--vscode-input-border" to "#80808080",
"--vscode-badge-background" to highlightHex,
"--vscode-badge-foreground" to defaultForegroundHex,
"--vscode-sideBar-border" to "#80808080"
"--vscode-sideBar-border" to "#80808080",
"--vscode-commandCenter-activeBorder" to highlightHex,
"--vscode-commandCenter-inactiveBorder" to "#80808080"
)
} catch (error: Error) {

View file

@ -62,7 +62,7 @@ class IdeProtocolClient(
"jetbrains/isOSREnabled" -> {
val isOSREnabled =
ServiceManager.getService(ContinueExtensionSettings::class.java).continueState.enableOSR
respond(isOSREnabled)
respond(isOSREnabled)
}
"jetbrains/getColors" -> {
@ -96,7 +96,7 @@ class IdeProtocolClient(
val sessionInfo = authService.loadControlPlaneSessionInfo()
respond(sessionInfo)
} else {
authService.startAuthFlow(project)
authService.startAuthFlow(project, params.useOnboarding)
respond(null)
}
}
@ -106,6 +106,10 @@ class IdeProtocolClient(
authService.signOut()
ApplicationManager.getApplication().messageBus.syncPublisher(AuthListener.TOPIC)
.handleUpdatedSessionInfo(null)
// Tell the webview that session info changed
continuePluginService.sendToWebview("didChangeControlPlaneSessionInfo", null, uuid())
respond(null)
}

View file

@ -93,8 +93,8 @@ class IntelliJIDE(
remoteConfigSyncPeriod = settings.continueState.remoteConfigSyncPeriod,
userToken = settings.continueState.userToken ?: "",
enableControlServerBeta = settings.continueState.enableContinueTeamsBeta,
continueTestEnvironment = settings.continueState.continueTestEnvironment,
pauseCodebaseIndexOnStart = false, // TODO: Needs to be implemented
continueTestEnvironment = "none"
)
}

View file

@ -2,7 +2,7 @@ package com.github.continuedev.continueintellijextension.protocol
import com.github.continuedev.continueintellijextension.*
data class GetControlPlaneSessionInfoParams(val silent: Boolean)
data class GetControlPlaneSessionInfoParams(val silent: Boolean, val useOnboarding: Boolean)
data class WriteFileParams(
val path: String,

View file

@ -2,6 +2,7 @@ package com.github.continuedev.continueintellijextension.services
import com.github.continuedev.continueintellijextension.constants.getConfigJsPath
import com.github.continuedev.continueintellijextension.constants.getConfigJsonPath
import com.intellij.execution.target.value.constant
import com.intellij.openapi.application.ApplicationInfo
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.components.*
@ -33,6 +34,7 @@ class ContinueSettingsComponent : DumbAware {
val enableOSR: JCheckBox = JCheckBox("Enable Off-Screen Rendering")
val displayEditorTooltip: JCheckBox = JCheckBox("Display Editor Tooltip")
val showIDECompletionSideBySide: JCheckBox = JCheckBox("Show IDE completions side-by-side")
val enableContinueHub: JCheckBox = JCheckBox("Enable Continue Hub")
init {
val constraints = GridBagConstraints()
@ -66,6 +68,8 @@ class ContinueSettingsComponent : DumbAware {
constraints.gridy++
panel.add(showIDECompletionSideBySide, constraints)
constraints.gridy++
panel.add(enableContinueHub, constraints)
constraints.gridy++
// Add a "filler" component that takes up all remaining vertical space
constraints.weighty = 1.0
@ -212,7 +216,8 @@ class ContinueExtensionConfigurable : Configurable {
mySettingsComponent?.enableContinueTeamsBeta?.isSelected != settings.continueState.enableContinueTeamsBeta ||
mySettingsComponent?.enableOSR?.isSelected != settings.continueState.enableOSR ||
mySettingsComponent?.displayEditorTooltip?.isSelected != settings.continueState.displayEditorTooltip ||
mySettingsComponent?.showIDECompletionSideBySide?.isSelected != settings.continueState.showIDECompletionSideBySide
mySettingsComponent?.showIDECompletionSideBySide?.isSelected != settings.continueState.showIDECompletionSideBySide ||
(if (mySettingsComponent?.enableContinueHub?.isSelected == true) settings.continueState.continueTestEnvironment != "production" else settings.continueState.continueTestEnvironment == "production")
return modified
}
@ -228,6 +233,8 @@ class ContinueExtensionConfigurable : Configurable {
settings.continueState.displayEditorTooltip = mySettingsComponent?.displayEditorTooltip?.isSelected ?: true
settings.continueState.showIDECompletionSideBySide =
mySettingsComponent?.showIDECompletionSideBySide?.isSelected ?: false
settings.continueState.continueTestEnvironment =
if (mySettingsComponent?.enableContinueHub?.isSelected == true) "production" else "none"
ApplicationManager.getApplication().messageBus.syncPublisher(SettingsListener.TOPIC)
.settingsUpdated(settings.continueState)
@ -245,6 +252,8 @@ class ContinueExtensionConfigurable : Configurable {
mySettingsComponent?.displayEditorTooltip?.isSelected = settings.continueState.displayEditorTooltip
mySettingsComponent?.showIDECompletionSideBySide?.isSelected =
settings.continueState.showIDECompletionSideBySide
mySettingsComponent?.enableContinueHub?.isSelected =
settings.continueState.continueTestEnvironment == "production"
ContinueExtensionSettings.instance.addRemoteSyncJob()
}

View file

@ -1,12 +1,12 @@
{
"name": "continue",
"version": "0.9.263",
"version": "0.9.265",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "continue",
"version": "0.9.263",
"version": "0.9.265",
"license": "Apache-2.0",
"dependencies": {
"@continuedev/fetch": "^1.0.3",

View file

@ -2,7 +2,7 @@
"name": "continue",
"icon": "media/icon.png",
"author": "Continue Dev, Inc",
"version": "0.9.264",
"version": "0.9.265",
"repository": {
"type": "git",
"url": "https://github.com/continuedev/continue"

View file

@ -1,6 +1,6 @@
import { ComputerDesktopIcon, SparklesIcon } from "@heroicons/react/24/outline";
import { ProfileDescription } from "core/config/ProfileLifecycleManager";
import { isLocalProfile } from "../../../util";
import { ComputerDesktopIcon, SparklesIcon } from "@heroicons/react/24/outline";
export interface AssistantIconProps {
assistant: ProfileDescription;
@ -10,7 +10,7 @@ export default function AssistantIcon({ assistant }: AssistantIconProps) {
if (isLocalProfile(assistant)) {
return <ComputerDesktopIcon />;
} else if (assistant.iconUrl) {
return <img src={assistant.iconUrl} className="rounded-full" />;
return <img src={assistant.iconUrl} className="h-4 w-4 rounded-full" />;
} else {
return <SparklesIcon />;
}