truetrue
diff --git a/extensions/intellij/CONTRIBUTING.md b/extensions/intellij/CONTRIBUTING.md
index 9757bc430..b345af3a5 100644
--- a/extensions/intellij/CONTRIBUTING.md
+++ b/extensions/intellij/CONTRIBUTING.md
@@ -101,6 +101,15 @@ allow for changes to your `config.json` and other files during development, with
When using the `Run Continue` task, we automatically tail both prompt logs and IDE logs.
+#### Viewing more IDE logs
+
+You can selectively increase the log granularity (e.g., debug-level logs) as follows:
+
+- Navigate to `Help | Diagnostic Tools | Debug Log Settings...`
+- Add a line in the format: `com.intellij.diagnostic:debug`
+
+You can find more information about this feature in [official docs](https://youtrack.jetbrains.com/articles/SUPPORT-A-43/How-to-enable-debug-logging-in-IntelliJ-IDEA).
+
### Reloading changes
- `extensions/intellij`: Attempt to reload changed classes by selecting
diff --git a/extensions/intellij/gradle.properties b/extensions/intellij/gradle.properties
index a1c5d01c1..2b6ee66d4 100644
--- a/extensions/intellij/gradle.properties
+++ b/extensions/intellij/gradle.properties
@@ -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=1.0.30
+pluginVersion=1.0.31
# 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
diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/actions/ContinuePluginActions.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/actions/ContinuePluginActions.kt
index c6df8eddd..b9eec734c 100644
--- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/actions/ContinuePluginActions.kt
+++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/actions/ContinuePluginActions.kt
@@ -10,7 +10,7 @@ import com.intellij.openapi.fileEditor.FileEditorManager
class RestartContinueProcess : AnAction() {
override fun actionPerformed(e: AnActionEvent) {
val pluginService = getContinuePluginService(e.project) ?: return
- pluginService.coreMessengerManager?.restart()
+ pluginService.coreMessengerManager?.coreMessenger?.restart()
}
}
diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/auth/ContinueAuthService.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/auth/ContinueAuthService.kt
index 4538b8771..e52a69711 100644
--- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/auth/ContinueAuthService.kt
+++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/auth/ContinueAuthService.kt
@@ -112,8 +112,10 @@ class ContinueAuthService {
val jsonBody = gson.toJson(mapOf("refreshToken" to refreshToken))
val url = getControlPlaneUrl() + "/auth/refresh"
val response = HttpRequests.post(url, HttpRequests.JSON_CONTENT_TYPE)
- .connect { connection -> connection.write(jsonBody.toByteArray()) }
- .toString()
+ .connect {
+ connection -> connection.write(jsonBody.toByteArray())
+ connection.readString()
+ }
return gson.fromJson(response, RefreshTokenResponse::class.java)
}
diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/ApplyToFileHandler.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/ApplyToFileHandler.kt
index 28b648d4a..856215be2 100644
--- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/ApplyToFileHandler.kt
+++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/ApplyToFileHandler.kt
@@ -29,6 +29,9 @@ class ApplyToFileHandler(
private val diffStreamService: DiffStreamService
) {
+ // Store the original file content before applying changes
+ private val originalFileContent: String? = editorUtils?.getDocumentText()
+
suspend fun handleApplyToFile() {
// Notify webview that we're starting to stream
notifyStreamStarted()
@@ -111,6 +114,7 @@ class ApplyToFileHandler(
numDiffs = numDiffs,
filepath = params.filepath,
fileContent = params.text,
+ originalFileContent = originalFileContent,
toolCallId = params.toolCallId.toString()
)
diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessenger.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessenger.kt
index 1c0ab242a..1e8e78208 100644
--- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessenger.kt
+++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessenger.kt
@@ -17,11 +17,11 @@ class CoreMessenger(
private val project: Project,
private val ideProtocolClient: IdeProtocolClient,
val coroutineScope: CoroutineScope,
- private val onExit: () -> Unit
+ private val onUnexpectedExit: () -> Unit
) {
private val gson = Gson()
private val responseListeners = mutableMapOf Unit>()
- private val process = startContinueProcess()
+ private var process = startContinueProcess()
private val log = Logger.getInstance(CoreMessenger::class.java)
fun request(messageType: String, data: Any?, messageId: String?, onResponse: (Any?) -> Unit) {
@@ -36,7 +36,7 @@ class CoreMessenger(
val process = if (isTcp)
ContinueSocketProcess()
else
- ContinueBinaryProcess(onExit)
+ ContinueBinaryProcess(onUnexpectedExit)
return ContinueProcessHandler(coroutineScope, process, ::handleMessage)
}
@@ -81,7 +81,15 @@ class CoreMessenger(
null
}
- fun killSubProcess() {
+ fun restart() {
+ log.warn("Restarting Continue process")
+ responseListeners.clear()
+ process.close()
+ process = startContinueProcess()
+ }
+
+ fun close() {
+ log.warn("Closing Continue process")
process.close()
}
}
\ No newline at end of file
diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessengerManager.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessengerManager.kt
index 3dbf9c2d5..71b367e20 100644
--- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessengerManager.kt
+++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessengerManager.kt
@@ -9,37 +9,34 @@ import com.intellij.openapi.project.Project
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
+import kotlin.time.Duration.Companion.seconds
class CoreMessengerManager(
- private val project: Project,
- private val ideProtocolClient: IdeProtocolClient,
+ project: Project,
+ ideProtocolClient: IdeProtocolClient,
private val coroutineScope: CoroutineScope
) {
- var coreMessenger: CoreMessenger = createCoreMessenger()
- private var lastBackoffInterval = 0.5
+ val coreMessenger = CoreMessenger(project, ideProtocolClient, coroutineScope, ::onUnexpectedExit)
+ private var backoffIntervalSeconds = 1
private val log = Logger.getInstance(CoreMessengerManager::class.java)
init {
setupAnonymousTelemetry()
}
- fun restart() {
+ private fun onUnexpectedExit() {
coroutineScope.launch {
try {
- coreMessenger.killSubProcess()
- lastBackoffInterval *= 2
- log.warn("Continue process exited, retrying in $lastBackoffInterval seconds")
- delay((lastBackoffInterval * 1000).toLong())
- coreMessenger = createCoreMessenger()
+ delay(backoffIntervalSeconds.seconds)
+ backoffIntervalSeconds *= 2
+ log.warn("Continue process terminated externally, retrying in $backoffIntervalSeconds seconds")
+ coreMessenger.restart()
} catch (e: Exception) {
service().capture("jetbrains_core_start_error", mapOf("error" to e))
}
}
}
- private fun createCoreMessenger() =
- CoreMessenger(project, ideProtocolClient, coroutineScope, ::restart)
-
private fun setupAnonymousTelemetry() {
coreMessenger.request("config/getSerializedProfileInfo", null, null) { response ->
val allowAnonymousTelemetry =
diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IntelliJIde.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IntelliJIde.kt
index 2f1889fb4..dc308d7de 100644
--- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IntelliJIde.kt
+++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IntelliJIde.kt
@@ -342,9 +342,10 @@ class IntelliJIDE(
val buffer = ByteArray(sizeToRead)
val bytesRead = fis.read(buffer, 0, sizeToRead)
if (bytesRead <= 0) return@use ""
- String(buffer, 0, bytesRead, Charset.forName("UTF-8"))
- // `\r` takes up unnecessary tokens
- .lineSequence().joinToString("\n")
+ val content = String(buffer, 0, bytesRead, Charset.forName("UTF-8"))
+ // Remove `\r` characters but preserve trailing newlines to prevent line count discrepancies
+ val contentWithoutCR = content.replace("\r\n", "\n").replace("\r", "\n")
+ contentWithoutCR
}
}
}
diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueBinaryProcess.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueBinaryProcess.kt
index eb45cc4da..6ef0c335b 100644
--- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueBinaryProcess.kt
+++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueBinaryProcess.kt
@@ -1,5 +1,7 @@
package com.github.continuedev.continueintellijextension.`continue`.process
+import com.github.continuedev.continueintellijextension.proxy.ProxySettings
+import com.github.continuedev.continueintellijextension.error.ContinueErrorService
import com.github.continuedev.continueintellijextension.services.TelemetryService
import com.github.continuedev.continueintellijextension.utils.OS
import com.github.continuedev.continueintellijextension.utils.getContinueBinaryPath
@@ -14,7 +16,9 @@ import java.nio.file.Files
import java.nio.file.Paths
import java.nio.file.attribute.PosixFilePermission
-class ContinueBinaryProcess(private val onExit: () -> Unit) : ContinueProcess {
+class ContinueBinaryProcess(
+ private val onUnexpectedExit: () -> Unit
+) : ContinueProcess {
private val process = startBinaryProcess()
override val input: InputStream = process.inputStream
@@ -28,11 +32,16 @@ class ContinueBinaryProcess(private val onExit: () -> Unit) : ContinueProcess {
runBlocking(Dispatchers.IO) {
setPermissions()
}
- return ProcessBuilder(path).directory(File(path).parentFile)
- .start()
- .apply { onExit().thenRun(onExit).thenRun { reportErrorTelemetry() } }
- }
+ val builder = ProcessBuilder(path)
+ val proxySettings = ProxySettings.getSettings()
+ if (proxySettings.enabled)
+ builder.environment() += "HTTP_PROXY" to proxySettings.proxy
+ return builder
+ .directory(File(path).parentFile)
+ .start()
+ .apply { onExit().thenRun(onUnexpectedExit).thenRun(::reportErrorTelemetry) }
+ }
private fun reportErrorTelemetry() {
var err = process.errorStream?.bufferedReader()?.readText()?.trim()
@@ -44,11 +53,8 @@ class ContinueBinaryProcess(private val onExit: () -> Unit) : ContinueProcess {
err = err.substring(doneIndex + delimiter.length)
}
}
-
- println("Core process exited with output: $err")
-
- val telemetryService = service()
- telemetryService.capture("jetbrains_core_exit", mapOf("error" to err))
+ service().reportMessage("Core process exited with output: $err")
+ service().capture("jetbrains_core_exit", mapOf("error" to err))
}
private companion object {
@@ -67,6 +73,7 @@ class ContinueBinaryProcess(private val onExit: () -> Unit) : ContinueProcess {
elevatePermissions()
}
+ // todo: consider setting permissions ahead-of-time during build/packaging, not at runtime
private fun elevatePermissions() {
val path = getContinueBinaryPath()
val permissions = setOf(
diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueProcessHandler.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueProcessHandler.kt
index 68ec83bf6..8e918b2c3 100644
--- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueProcessHandler.kt
+++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/process/ContinueProcessHandler.kt
@@ -2,6 +2,7 @@ package com.github.continuedev.continueintellijextension.`continue`.process
import com.github.continuedev.continueintellijextension.error.ContinueErrorService
import com.intellij.openapi.components.service
+import com.intellij.openapi.diagnostic.Logger
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.Channel
import java.io.BufferedReader
@@ -19,6 +20,7 @@ class ContinueProcessHandler(
private val pendingWrites = Channel(Channel.UNLIMITED)
private val writer = OutputStreamWriter(process.output)
private val reader = BufferedReader(InputStreamReader(process.input))
+ private val log = Logger.getInstance(ContinueProcessHandler::class.java)
init {
scope.launch(Dispatchers.IO) {
@@ -27,6 +29,7 @@ class ContinueProcessHandler(
val line = reader.readLine()
if (line != null && line.isNotEmpty()) {
try {
+ log.debug("Handle: $line")
handleMessage(line)
} catch (e: Exception) {
service().report(e, "Error handling message: $line")
@@ -40,6 +43,7 @@ class ContinueProcessHandler(
}
scope.launch(Dispatchers.IO) {
for (message in pendingWrites) {
+ log.debug("Write: $message")
writer.write(message)
writer.write("\r\n")
writer.flush()
diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/error/ContinueErrorService.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/error/ContinueErrorService.kt
index 21f920ef9..35e23d8a2 100644
--- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/error/ContinueErrorService.kt
+++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/error/ContinueErrorService.kt
@@ -6,6 +6,7 @@ import com.intellij.openapi.components.Service
import com.intellij.openapi.diagnostic.Attachment
import com.intellij.openapi.diagnostic.Logger
import com.intellij.openapi.extensions.PluginId
+import com.intellij.openapi.util.SystemInfo
import com.intellij.ui.jcef.JBCefApp
import io.sentry.Hint
import io.sentry.Sentry
@@ -26,6 +27,8 @@ class ContinueErrorService {
config.setTag("ide_version", ApplicationInfo.getInstance().build.asString())
config.setTag("jcef_supported", JBCefApp.isSupported().toString())
config.setTag("plugin_version", PluginManagerCore.getPlugin(PluginId.getId(PLUGIN_ID))?.version)
+ config.setTag("system", SystemInfo.OS_NAME)
+ config.setTag("system_version", SystemInfo.OS_VERSION)
}
}
@@ -39,7 +42,14 @@ class ContinueErrorService {
sentryEvent.message = Message().apply { this.message = message }
val hint = Hint.withAttachments(attachments?.map { SentryAttachment(it.bytes, it.path) })
Sentry.captureEvent(sentryEvent, hint)
- log.warn("Problem sent to Sentry: $message", throwable)
+ log.warn("Exception sent to Sentry: $message", throwable)
+ }
+
+ fun reportMessage(
+ message: String,
+ ) {
+ Sentry.captureMessage(message)
+ log.warn("Message sent to Sentry: $message")
}
private companion object {
diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/proxy/ProxyPoolingActivity.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/proxy/ProxyPoolingActivity.kt
new file mode 100644
index 000000000..0d88d0bdd
--- /dev/null
+++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/proxy/ProxyPoolingActivity.kt
@@ -0,0 +1,36 @@
+package com.github.continuedev.continueintellijextension.proxy
+
+import com.github.continuedev.continueintellijextension.services.ContinuePluginService
+import com.intellij.openapi.components.service
+import com.intellij.openapi.diagnostic.Logger
+import com.intellij.openapi.project.Project
+import com.intellij.openapi.startup.StartupActivity
+import kotlinx.coroutines.*
+import kotlin.time.Duration.Companion.seconds
+
+class ProxyPoolingActivity : StartupActivity {
+ private val scope = CoroutineScope(Dispatchers.Default)
+ private var lastSettings = ProxySettings.getSettings()
+ private val log = Logger.getInstance(ProxyPoolingActivity::class.java)
+
+ override fun runActivity(project: Project) {
+ scope.launch {
+ while (isActive) {
+ val newSettings = ProxySettings.getSettings()
+ if (newSettings != lastSettings) {
+ onSettingsChanged(project)
+ lastSettings = newSettings
+ }
+ delay(2.seconds)
+ }
+ }
+ }
+
+ private fun onSettingsChanged(project: Project) {
+ log.warn("Proxy settings changed, restarting")
+ project.service().coreMessengerManager?.coreMessenger?.restart()
+ }
+}
+
+
+
diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/proxy/ProxySettings.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/proxy/ProxySettings.kt
new file mode 100644
index 000000000..70c66637c
--- /dev/null
+++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/proxy/ProxySettings.kt
@@ -0,0 +1,20 @@
+package com.github.continuedev.continueintellijextension.proxy
+
+import com.intellij.util.net.HttpConfigurable
+
+data class ProxySettings(
+ val enabled: Boolean,
+ val proxy: String,
+) {
+
+ companion object {
+ fun getSettings(): ProxySettings {
+ val settings = HttpConfigurable.getInstance()
+ return ProxySettings(
+ enabled = settings.USE_HTTP_PROXY,
+ proxy = "${settings.PROXY_HOST}:${settings.PROXY_PORT}"
+ )
+ }
+ }
+
+}
diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/services/ContinuePluginService.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/services/ContinuePluginService.kt
index 6ebb8f41f..102981715 100644
--- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/services/ContinuePluginService.kt
+++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/services/ContinuePluginService.kt
@@ -33,7 +33,7 @@ class ContinuePluginService : Disposable, DumbAware {
coroutineScope.cancel()
coreMessenger?.coroutineScope?.let {
it.cancel()
- coreMessenger?.killSubProcess()
+ coreMessenger?.close()
}
}
diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinuePluginToolWindowFactory.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinuePluginToolWindowFactory.kt
index 4afa1cb45..256dba81e 100644
--- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinuePluginToolWindowFactory.kt
+++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinuePluginToolWindowFactory.kt
@@ -2,62 +2,69 @@ package com.github.continuedev.continueintellijextension.toolWindow
import com.github.continuedev.continueintellijextension.services.ContinuePluginService
import com.intellij.openapi.actionSystem.ActionManager
-import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.components.service
import com.intellij.openapi.project.DumbAware
import com.intellij.openapi.project.Project
import com.intellij.openapi.wm.ToolWindow
import com.intellij.openapi.wm.ToolWindowFactory
import com.intellij.ui.content.ContentFactory
+import com.intellij.ui.dsl.builder.AlignX
+import com.intellij.ui.dsl.builder.panel
+import com.intellij.ui.jcef.JBCefApp
+import com.intellij.util.ui.JBUI.Borders.empty
import javax.swing.JComponent
+import javax.swing.JPanel
const val JS_QUERY_POOL_SIZE = "200"
class ContinuePluginToolWindowFactory : ToolWindowFactory, DumbAware {
- override fun createToolWindowContent(project: Project, toolWindow: ToolWindow) {
- val continueToolWindow = ContinuePluginWindow(project)
- val content =
- ContentFactory.getInstance().createContent(continueToolWindow.content, null, false)
- toolWindow.contentManager.addContent(content)
- val titleActions = mutableListOf()
- createTitleActions(titleActions)
-
- // Add MaximizeToolWindow action
- val action = ActionManager.getInstance().getAction("MaximizeToolWindow")
- if (action != null) {
- titleActions.add(action)
+ override fun createToolWindowContent(project: Project, toolWindow: ToolWindow) {
+ val inner = if (JBCefApp.isSupported())
+ ContinuePluginWindow(project).content
+ else
+ createNotSupportedPanel()
+ val content = ContentFactory.getInstance().createContent(inner, null, false)
+ toolWindow.contentManager.addContent(content)
+ toolWindow.setTitleActions(
+ listOf(
+ ActionManager.getInstance().getAction("ContinueSidebarActionsGroup"),
+ ActionManager.getInstance().getAction("MaximizeToolWindow")
+ )
+ )
}
- toolWindow.setTitleActions(titleActions)
- }
+ override fun shouldBeAvailable(project: Project) = true
- private fun createTitleActions(titleActions: MutableList) {
- val action = ActionManager.getInstance().getAction("ContinueSidebarActionsGroup")
- if (action != null) {
- titleActions.add(action)
- }
- }
-
- override fun shouldBeAvailable(project: Project) = true
-
- class ContinuePluginWindow(project: Project) {
- private val defaultGUIUrl = "http://continue/index.html"
-
- init {
- System.setProperty("ide.browser.jcef.jsQueryPoolSize", JS_QUERY_POOL_SIZE)
- System.setProperty("ide.browser.jcef.contextMenu.devTools.enabled", "true")
- System.setProperty("ide.browser.jcef.out-of-process.enabled", "false")
+ private fun createNotSupportedPanel(): JPanel {
+ val html = ContinuePluginToolWindowFactory::class.java.classLoader
+ .getResourceAsStream("jcef_error.html")
+ .bufferedReader()
+ .readText()
+ return panel {
+ row {
+ text(html)
+ }
+ }.withBorder(empty(10))
}
- val browser: ContinueBrowser by lazy {
- val url = System.getenv("GUI_URL")?.toString() ?: defaultGUIUrl
+ class ContinuePluginWindow(project: Project) {
+ private val defaultGUIUrl = "http://continue/index.html"
- val browser = ContinueBrowser(project, url)
- project.service().continuePluginWindow = this
- browser
+ init {
+ System.setProperty("ide.browser.jcef.jsQueryPoolSize", JS_QUERY_POOL_SIZE)
+ System.setProperty("ide.browser.jcef.contextMenu.devTools.enabled", "true")
+ System.setProperty("ide.browser.jcef.out-of-process.enabled", "false")
+ }
+
+ val browser: ContinueBrowser by lazy {
+ val url = System.getenv("GUI_URL") ?: defaultGUIUrl
+
+ val browser = ContinueBrowser(project, url)
+ project.service().continuePluginWindow = this
+ browser
+ }
+
+ val content: JComponent
+ get() = browser.browser.component
}
-
- val content: JComponent
- get() = browser.browser.component
- }
}
diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/types.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/types.kt
index 133c80e63..32c7802ad 100644
--- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/types.kt
+++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/types.kt
@@ -290,6 +290,7 @@ data class ApplyState(
val numDiffs: Int? = null,
val filepath: String? = null,
val fileContent: String? = null,
+ val originalFileContent: String? = null,
val toolCallId: String? = null
)
diff --git a/extensions/intellij/src/main/resources/META-INF/plugin.xml b/extensions/intellij/src/main/resources/META-INF/plugin.xml
index 15a0dd864..22ceb6772 100644
--- a/extensions/intellij/src/main/resources/META-INF/plugin.xml
+++ b/extensions/intellij/src/main/resources/META-INF/plugin.xml
@@ -40,6 +40,7 @@
+
+
+
+
Continue Chat is Unable to Load
+
+
Continue Chat requires a JRE that supports the Java Chromium Embedded Framework (JCEF) to render our webview. You can
+ still use Autocomplete and Edit.
+
How to Fix It?
+
You can manually switch to a JRE that supports JCEF:
+
+
In the main menu, go to Help | Find Action or press
+ Ctrl + Shift + A.
+
+
Find and select the Choose Boot Java Runtime for the IDE action.
+
Select the runtime that comes with JCEF support and click OK.
+
Restart with the new runtime.
+
+
Runtimes that support JCEF are usually called JetBrains Runtime and have the -jcef suffix,
+ for example 21.0.3+13-509.11-jcef.
+
+You can find more information in the JetBrains documentation.
+
\ No newline at end of file
diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json
index a6a86e3b4..9483160c6 100644
--- a/extensions/vscode/package-lock.json
+++ b/extensions/vscode/package-lock.json
@@ -1,16 +1,16 @@
{
"name": "continue",
- "version": "1.1.66",
+ "version": "1.1.67",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "continue",
- "version": "1.1.66",
+ "version": "1.1.67",
"license": "Apache-2.0",
"dependencies": {
- "@continuedev/config-types": "^1.0.14",
- "@continuedev/fetch": "^1.0.10",
+ "@continuedev/config-types": "file:../../packages/config-types",
+ "@continuedev/fetch": "file:../../packages/fetch",
"@electron/rebuild": "^3.2.10",
"@reduxjs/toolkit": "^1.9.3",
"@vscode/ripgrep": "^1.15.9",
@@ -105,8 +105,8 @@
"@aws-sdk/credential-providers": "^3.778.0",
"@continuedev/config-types": "^1.0.13",
"@continuedev/config-yaml": "file:../packages/config-yaml",
- "@continuedev/fetch": "^1.0.14",
- "@continuedev/llm-info": "^1.0.8",
+ "@continuedev/fetch": "file:../packages/fetch",
+ "@continuedev/llm-info": "file:../packages/llm-info",
"@continuedev/openai-adapters": "file:../packages/openai-adapters",
"@modelcontextprotocol/sdk": "^1.12.0",
"@mozilla/readability": "^0.5.0",
@@ -208,6 +208,41 @@
"node": ">=20.19.0"
}
},
+ "../../packages/config-types": {
+ "name": "@continuedev/config-types",
+ "version": "1.0.14",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "zod": "^3.24.2"
+ },
+ "devDependencies": {
+ "@types/node": "^20.11.19",
+ "typescript": "^5.5.2"
+ }
+ },
+ "../../packages/fetch": {
+ "name": "@continuedev/fetch",
+ "version": "1.0.15",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@continuedev/config-types": "file:../config-types",
+ "follow-redirects": "^1.15.6",
+ "http-proxy-agent": "^7.0.2",
+ "https-proxy-agent": "^7.0.5",
+ "node-fetch": "^3.3.2"
+ },
+ "devDependencies": {
+ "@types/follow-redirects": "^1.14.4",
+ "typescript": "^5.0.0",
+ "vitest": "^3.2.0"
+ }
+ },
+ "../packages/config-types": {
+ "extraneous": true
+ },
+ "../packages/fetch": {
+ "extraneous": true
+ },
"node_modules/@75lb/deep-merge": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@75lb/deep-merge/-/deep-merge-1.1.2.tgz",
@@ -703,25 +738,12 @@
}
},
"node_modules/@continuedev/config-types": {
- "version": "1.0.14",
- "resolved": "https://registry.npmjs.org/@continuedev/config-types/-/config-types-1.0.14.tgz",
- "integrity": "sha512-PVHyHPyRXd2QsaNgnCpiKYU3uHFTlyuQSkqE8OwrBmQqO6/TXUVIr/2EGtyIZGrml4Y+rGMSH40WU4/0t4SGpQ==",
- "dependencies": {
- "zod": "^3.23.8"
- }
+ "resolved": "../../packages/config-types",
+ "link": true
},
"node_modules/@continuedev/fetch": {
- "version": "1.0.10",
- "resolved": "https://registry.npmjs.org/@continuedev/fetch/-/fetch-1.0.10.tgz",
- "integrity": "sha512-RBUXtm/VDz+9Itgw+CxrHXwVXoHCAedGzPOgA7gS5HZ9lObaeCJgEfzmfbln1ocFsfqSFmn5X5wSE7DHgfxpVA==",
- "license": "Apache-2.0",
- "dependencies": {
- "@continuedev/config-types": "^1.0.5",
- "follow-redirects": "^1.15.6",
- "http-proxy-agent": "^7.0.2",
- "https-proxy-agent": "^7.0.5",
- "node-fetch": "^3.3.2"
- }
+ "resolved": "../../packages/fetch",
+ "link": true
},
"node_modules/@electron/node-gyp": {
"version": "10.2.0-electron.1",
@@ -16742,14 +16764,6 @@
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
- },
- "node_modules/zod": {
- "version": "3.23.8",
- "resolved": "https://registry.npmjs.org/zod/-/zod-3.23.8.tgz",
- "integrity": "sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==",
- "funding": {
- "url": "https://github.com/sponsors/colinhacks"
- }
}
}
}
diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json
index a813e7b95..f389add49 100644
--- a/extensions/vscode/package.json
+++ b/extensions/vscode/package.json
@@ -2,7 +2,7 @@
"name": "continue",
"icon": "media/icon.png",
"author": "Continue Dev, Inc",
- "version": "1.1.66",
+ "version": "1.1.67",
"repository": {
"type": "git",
"url": "https://github.com/continuedev/continue"
@@ -717,8 +717,8 @@
"vscode-extension-tester": "^8.14.1"
},
"dependencies": {
- "@continuedev/config-types": "^1.0.14",
- "@continuedev/fetch": "^1.0.10",
+ "@continuedev/config-types": "file:../../packages/config-types",
+ "@continuedev/fetch": "file:../../packages/fetch",
"@electron/rebuild": "^3.2.10",
"@reduxjs/toolkit": "^1.9.3",
"@vscode/ripgrep": "^1.15.9",
diff --git a/extensions/vscode/src/apply/ApplyManager.ts b/extensions/vscode/src/apply/ApplyManager.ts
index 1ac84c368..c12d6323a 100644
--- a/extensions/vscode/src/apply/ApplyManager.ts
+++ b/extensions/vscode/src/apply/ApplyManager.ts
@@ -29,13 +29,6 @@ export class ApplyManager {
toolCallId,
isSearchAndReplace,
}: ApplyToFilePayload) {
- await this.webviewProtocol.request("updateApplyState", {
- streamId,
- status: "streaming",
- fileContent: text,
- toolCallId,
- });
-
if (filepath) {
await this.ensureFileOpen(filepath);
}
@@ -46,6 +39,17 @@ export class ApplyManager {
return;
}
+ // Capture the original file content before applying changes
+ const originalFileContent = activeTextEditor.document.getText();
+
+ await this.webviewProtocol.request("updateApplyState", {
+ streamId,
+ status: "streaming",
+ fileContent: text,
+ originalFileContent,
+ toolCallId,
+ });
+
const hasExistingDocument = !!activeTextEditor.document.getText().trim();
if (hasExistingDocument) {
diff --git a/extensions/vscode/src/diff/vertical/handler.ts b/extensions/vscode/src/diff/vertical/handler.ts
index 339f9e84b..869e5962d 100644
--- a/extensions/vscode/src/diff/vertical/handler.ts
+++ b/extensions/vscode/src/diff/vertical/handler.ts
@@ -315,11 +315,12 @@ export class VerticalDiffHandler implements vscode.Disposable {
// newline separated, because myersDiff() would consider
// ["A"] => "A" and ["A", ""] => "A\n" to be the same single line.
// "A\n" and "A\n\n" are unambiguous.
- const oldFileContent =
- diffLines
- .filter((line) => line.type === "same" || line.type === "old")
- .map((line) => line.line)
- .join("\n") + "\n";
+ const oldContentWithoutTrailingNewline = diffLines
+ .filter((line) => line.type === "same" || line.type === "old")
+ .map((line) => line.line)
+ .join("\n");
+
+ const oldFileContent = oldContentWithoutTrailingNewline + "\n";
const newFileContent =
diffLines
@@ -329,9 +330,16 @@ export class VerticalDiffHandler implements vscode.Disposable {
const myersDiffs = myersDiff(oldFileContent, newFileContent);
- const replaceContent = myersDiffs
- .map((diff) => (diff.type === "old" ? "" : diff.line))
- .join("\n");
+ // Preserve the trailing newline behavior by checking the original document content
+ const originalDocumentContent = this.editor.document.getText(this.range);
+ const originalContentEndsWithNewline =
+ originalDocumentContent.endsWith("\n");
+
+ // Add trailing newline only if the original file had one to prevent line count discrepancies
+ const replaceContent =
+ myersDiffs
+ .map((diff) => (diff.type === "old" ? "" : diff.line))
+ .join("\n") + (originalContentEndsWithNewline ? "\n" : "");
// Then, we insert our diff lines
await this.editor.edit((editBuilder) => {
diff --git a/extensions/vscode/src/extension/EditOutcomeTracker.ts b/extensions/vscode/src/extension/EditOutcomeTracker.ts
index c69dbac72..69ac452fa 100644
--- a/extensions/vscode/src/extension/EditOutcomeTracker.ts
+++ b/extensions/vscode/src/extension/EditOutcomeTracker.ts
@@ -65,6 +65,7 @@ class EditOutcomeTracker {
newCodeLines: pendingEdit.newCodeLines,
lineChange: pendingEdit.lineChange,
accepted,
+ filepath: pendingEdit.filepath,
},
});
diff --git a/gui/package-lock.json b/gui/package-lock.json
index c9ad23ed0..ce7be87e5 100644
--- a/gui/package-lock.json
+++ b/gui/package-lock.json
@@ -116,8 +116,8 @@
"@aws-sdk/credential-providers": "^3.778.0",
"@continuedev/config-types": "^1.0.13",
"@continuedev/config-yaml": "file:../packages/config-yaml",
- "@continuedev/fetch": "^1.0.14",
- "@continuedev/llm-info": "^1.0.8",
+ "@continuedev/fetch": "file:../packages/fetch",
+ "@continuedev/llm-info": "file:../packages/llm-info",
"@continuedev/openai-adapters": "file:../packages/openai-adapters",
"@modelcontextprotocol/sdk": "^1.12.0",
"@mozilla/readability": "^0.5.0",
@@ -224,7 +224,7 @@
"version": "1.0.96",
"license": "Apache-2.0",
"dependencies": {
- "@continuedev/config-types": "^1.0.14",
+ "@continuedev/config-types": "file:../config-types",
"yaml": "^2.6.1",
"zod": "^3.24.2"
},
diff --git a/gui/src/components/StyledMarkdownPreview/index.tsx b/gui/src/components/StyledMarkdownPreview/index.tsx
index aed35e735..5b1249cd8 100644
--- a/gui/src/components/StyledMarkdownPreview/index.tsx
+++ b/gui/src/components/StyledMarkdownPreview/index.tsx
@@ -113,6 +113,10 @@ const StyledMarkdown = styled.div<{
line-height: 1.5;
}
+ * {
+ word-break: break-word;
+ }
+
> *:last-child {
margin-bottom: 0;
}
diff --git a/gui/src/components/StyledMarkdownPreview/utils/headerIsMarkdown.test.ts b/gui/src/components/StyledMarkdownPreview/utils/headerIsMarkdown.test.ts
deleted file mode 100644
index 51649c251..000000000
--- a/gui/src/components/StyledMarkdownPreview/utils/headerIsMarkdown.test.ts
+++ /dev/null
@@ -1,67 +0,0 @@
-import { headerIsMarkdown } from "./headerIsMarkdown";
-
-describe("headerIsMarkdown", () => {
- // Test exact match with common Markdown identifiers
- it("should identify exact matches with common Markdown identifiers", () => {
- expect(headerIsMarkdown("md")).toBe(true);
- expect(headerIsMarkdown("markdown")).toBe(true);
- expect(headerIsMarkdown("gfm")).toBe(true);
- expect(headerIsMarkdown("github-markdown")).toBe(true);
- });
-
- // Test identifiers preceded by a space
- it("should identify identifiers preceded by a space", () => {
- expect(headerIsMarkdown("lang md")).toBe(true);
- expect(headerIsMarkdown("something markdown")).toBe(true);
- expect(headerIsMarkdown("language gfm")).toBe(true);
- expect(headerIsMarkdown("spec github-markdown")).toBe(true);
- });
-
- // Test file extensions
- it("should identify file names with markdown extensions", () => {
- expect(headerIsMarkdown("example.md")).toBe(true);
- expect(headerIsMarkdown("document.markdown")).toBe(true);
- expect(headerIsMarkdown("readme.gfm")).toBe(true);
- });
-
- // Test more complex cases with extensions
- it("should identify file names with markdown extensions followed by other text", () => {
- expect(headerIsMarkdown("example.md additional text")).toBe(true);
- expect(headerIsMarkdown("document.markdown with some description")).toBe(
- true,
- );
- expect(headerIsMarkdown("readme.gfm v2.0")).toBe(true);
- });
-
- // Test non-markdown cases
- it("should not identify non-markdown headers", () => {
- expect(headerIsMarkdown("javascript")).toBe(false);
- expect(headerIsMarkdown("typescript")).toBe(false);
- expect(headerIsMarkdown("plain")).toBe(false);
- expect(headerIsMarkdown("python")).toBe(false);
- });
-
- // Test edge cases
- it("should handle edge cases correctly", () => {
- expect(headerIsMarkdown("")).toBe(false);
- expect(headerIsMarkdown("mdx")).toBe(false); // Similar but not exactly "md"
- expect(headerIsMarkdown("readme md")).toBe(true);
- expect(headerIsMarkdown("md.js")).toBe(false); // "md" is not the extension
- });
-
- // Test case sensitivity
- it("should respect case sensitivity", () => {
- expect(headerIsMarkdown("MD")).toBe(false);
- expect(headerIsMarkdown("MARKDOWN")).toBe(false);
- expect(headerIsMarkdown("example.MD")).toBe(false);
- expect(headerIsMarkdown("lang MD")).toBe(false);
- });
-
- // Test with special characters and spacing
- it("should handle special characters and spacing correctly", () => {
- expect(headerIsMarkdown(" md")).toBe(true); // Space before "md"
- expect(headerIsMarkdown("md ")).toBe(true); // Space after "md"
- expect(headerIsMarkdown("hello-md")).toBe(false); // "md" with hyphen prefix
- expect(headerIsMarkdown("markdown:")).toBe(false); // "markdown" with suffix
- });
-});
diff --git a/gui/src/components/StyledMarkdownPreview/utils/headerIsMarkdown.ts b/gui/src/components/StyledMarkdownPreview/utils/headerIsMarkdown.ts
deleted file mode 100644
index cfdba2fde..000000000
--- a/gui/src/components/StyledMarkdownPreview/utils/headerIsMarkdown.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * Determines if a given header string represents Markdown content.
- *
- * The function checks various patterns to identify Markdown headers:
- * - Exact match with common Markdown identifiers (md, markdown, gfm, github-markdown)
- * - Contains these identifiers preceded by a space
- * - First word has a file extension of md, markdown, or gfm
- *
- * @param header - The string to check for Markdown indicators
- * @returns True if the header represents Markdown content, false otherwise
- */
-export function headerIsMarkdown(header: string): boolean {
- return (
- header === "md" ||
- header === "markdown" ||
- header === "gfm" ||
- header === "github-markdown" ||
- header.includes(" md") ||
- header.includes(" markdown") ||
- header.includes(" gfm") ||
- header.includes(" github-markdown") ||
- header.split(" ")[0]?.split(".").pop() === "md" ||
- header.split(" ")[0]?.split(".").pop() === "markdown" ||
- header.split(" ")[0]?.split(".").pop() === "gfm"
- );
-}
diff --git a/gui/src/components/StyledMarkdownPreview/utils/patchNestedMarkdown.test.ts b/gui/src/components/StyledMarkdownPreview/utils/patchNestedMarkdown.test.ts
index af94f118d..4e347a9e2 100644
--- a/gui/src/components/StyledMarkdownPreview/utils/patchNestedMarkdown.test.ts
+++ b/gui/src/components/StyledMarkdownPreview/utils/patchNestedMarkdown.test.ts
@@ -6,6 +6,14 @@ describe("patchNestedMarkdown", () => {
expect(patchNestedMarkdown(source)).toBe(source);
});
+ it("should handle nested blocks without a type", () => {
+ const source =
+ "```markdown README.md\n# Project Structure\n\n```\n.\nโโโ AdvancedPage.tsx\nโโโ Calculator.java\nโโโ Dockerfile\nโโโ calculator_test/\nโ โโโ Calculator.java\nโ โโโ Main.java\nโโโ data.json\nโโโ example.ipynb\nโโโ logs/\nโโโ nested-folder/\nโ โโโ helloNested.py\nโ โโโ package.json\nโ โโโ rules.md\nโโโ program.cs\nโโโ query.sql\nโโโ react-calculator/\nโโโ readme.md\nโโโ requirements.txt\nโโโ test.css\nโโโ test.html\nโโโ test.js\nโโโ test.kt\nโโโ test.php\nโโโ test.py\nโโโ test.rb\nโโโ test.rs\nโโโ test.sh\nโโโ test.ts\n```\n```";
+ const expected =
+ "~~~markdown README.md\n# Project Structure\n\n```\n.\nโโโ AdvancedPage.tsx\nโโโ Calculator.java\nโโโ Dockerfile\nโโโ calculator_test/\nโ โโโ Calculator.java\nโ โโโ Main.java\nโโโ data.json\nโโโ example.ipynb\nโโโ logs/\nโโโ nested-folder/\nโ โโโ helloNested.py\nโ โโโ package.json\nโ โโโ rules.md\nโโโ program.cs\nโโโ query.sql\nโโโ react-calculator/\nโโโ readme.md\nโโโ requirements.txt\nโโโ test.css\nโโโ test.html\nโโโ test.js\nโโโ test.kt\nโโโ test.php\nโโโ test.py\nโโโ test.rb\nโโโ test.rs\nโโโ test.sh\nโโโ test.ts\n```\n~~~";
+ expect(patchNestedMarkdown(source)).toBe(expected);
+ });
+
it("should replace backticks with tildes for markdown codeblocks", () => {
const source = "```markdown\n# Header\nSome text\n```";
const expected = "~~~markdown\n# Header\nSome text\n~~~";
diff --git a/gui/src/components/StyledMarkdownPreview/utils/patchNestedMarkdown.ts b/gui/src/components/StyledMarkdownPreview/utils/patchNestedMarkdown.ts
index 9be5bfbb2..380c1a18a 100644
--- a/gui/src/components/StyledMarkdownPreview/utils/patchNestedMarkdown.ts
+++ b/gui/src/components/StyledMarkdownPreview/utils/patchNestedMarkdown.ts
@@ -7,7 +7,10 @@
Note, this was benchmarked at sub-millisecond
*/
-import { headerIsMarkdown } from "./headerIsMarkdown";
+import {
+ headerIsMarkdown,
+ MarkdownBlockStateTracker,
+} from "../../../../../core/utils/markdownUtils";
export const patchNestedMarkdown = (source: string): string => {
// Early return if no markdown codeblock pattern is found (including GitHub variants)
@@ -16,21 +19,29 @@ export const patchNestedMarkdown = (source: string): string => {
let nestCount = 0;
const lines = source.split("\n");
- const trimmedLines = lines.map((l) => l.trim());
+
+ // Use optimized state tracker for efficient bare backtick analysis
+ const stateTracker = new MarkdownBlockStateTracker(lines);
+ const trimmedLines = stateTracker.getTrimmedLines();
for (let i = 0; i < trimmedLines.length; i++) {
const line = trimmedLines[i];
if (nestCount > 0) {
// Inside a markdown block
- if (line.match(/^`+$/)) {
- // Ending a block with just backticks (```)
- nestCount--;
- if (nestCount === 0) {
- lines[i] = "~~~"; // End of markdown block
+ if (stateTracker.isBareBacktickLine(i)) {
+ // Found bare backticks - use optimized lookup for remaining count
+ const remainingBareBackticks =
+ stateTracker.getRemainingBareBackticksAfter(i);
+
+ // If this is the last bare backticks, it closes the markdown block
+ if (remainingBareBackticks === 0) {
+ nestCount = 0;
+ lines[i] = "~~~"; // Convert final closing delimiter to tildes
}
+ // Otherwise, keep as backticks (inner nested block delimiter)
} else if (line.startsWith("```")) {
- // Going into a nested codeblock
+ // Going into a nested codeblock (with language identifier)
nestCount++;
}
} else {
diff --git a/gui/src/components/gui/Alert.tsx b/gui/src/components/gui/Alert.tsx
index a2739757f..f7eb5b845 100644
--- a/gui/src/components/gui/Alert.tsx
+++ b/gui/src/components/gui/Alert.tsx
@@ -3,7 +3,7 @@ import {
ExclamationCircleIcon,
ExclamationTriangleIcon,
InformationCircleIcon,
-} from "@heroicons/react/24/solid";
+} from "@heroicons/react/16/solid";
import { ReactNode } from "react";
import { vscBackground } from "..";
diff --git a/gui/src/components/mainInput/InputToolbar.tsx b/gui/src/components/mainInput/InputToolbar.tsx
index 9be9f25d9..0e2aaa52a 100644
--- a/gui/src/components/mainInput/InputToolbar.tsx
+++ b/gui/src/components/mainInput/InputToolbar.tsx
@@ -1,8 +1,9 @@
import {
AtSymbolIcon,
- LightBulbIcon,
+ LightBulbIcon as LightBulbIconOutline,
PhotoIcon,
} from "@heroicons/react/24/outline";
+import { LightBulbIcon as LightBulbIconSolid } from "@heroicons/react/24/solid";
import { InputModifiers } from "core";
import { modelSupportsImages, modelSupportsTools } from "core/llm/autodetect";
import { useContext, useRef } from "react";
@@ -13,7 +14,6 @@ import { selectSelectedChatModel } from "../../redux/slices/configSlice";
import { setHasReasoningEnabled } from "../../redux/slices/sessionSlice";
import { exitEdit } from "../../redux/thunks/edit";
import { getAltKeyLabel, isMetaEquivalentKeyPressed } from "../../util";
-import { cn } from "../../util/cn";
import { ToolTip } from "../gui/Tooltip";
import ModelSelect from "../modelSelection/ModelSelect";
import { ModeSelect } from "../ModeSelect";
@@ -141,19 +141,23 @@ function InputToolbar(props: InputToolbarProps) {
)}
- {defaultModel?.provider === "anthropic" && (
+ {defaultModel?.underlyingProviderName === "anthropic" && (
dispatch(setHasReasoningEnabled(!hasReasoningEnabled))
}
>
-
+ {hasReasoningEnabled ? (
+
+ ) : (
+
+ )}
{hasReasoningEnabled
diff --git a/gui/src/components/mainInput/Lump/LumpToolbar/GeneratingIndicator.tsx b/gui/src/components/mainInput/Lump/LumpToolbar/GeneratingIndicator.tsx
index e6d38d85a..0f95a4e40 100644
--- a/gui/src/components/mainInput/Lump/LumpToolbar/GeneratingIndicator.tsx
+++ b/gui/src/components/mainInput/Lump/LumpToolbar/GeneratingIndicator.tsx
@@ -8,8 +8,8 @@ export function GeneratingIndicator({
testId?: string;
}) {
return (
-
- {text}
+
+ {text}
);
diff --git a/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPoliciesSection.tsx b/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPoliciesSection.tsx
index 8adfa75d2..5aee1466f 100644
--- a/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPoliciesSection.tsx
+++ b/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPoliciesSection.tsx
@@ -1,4 +1,4 @@
-import { Tool } from "core";
+import { MessageModes, Tool } from "core";
import { useMemo } from "react";
import { useAppDispatch, useAppSelector } from "../../../../../redux/hooks";
import { toggleToolGroupSetting } from "../../../../../redux/slices/uiSlice";
@@ -43,20 +43,28 @@ export const ToolPoliciesSection = () => {
const allToolsOff = mode === "chat";
- const message =
- mode === "chat"
- ? "All tools disabled (Chat)"
- : mode === "plan"
- ? "Read-only/MCP tools available (Plan)"
- : "All tools available (Agent)";
+ const getMessage = (mode: MessageModes) => {
+ switch (mode) {
+ case "chat":
+ return "All tools disabled in Chat, switch to Plan or Agent mode to use tools";
+ case "plan":
+ return "Read-only/MCP tools available in Plan mode";
+ default:
+ return "";
+ }
+ };
+
+ const message = getMessage(mode);
return (
<>
-