Skip to content

Commit 05e440d

Browse files
authored
Merge pull request #42 from phodal/feat/vscode-renderer-improvements
fix(idea): use correct project basePath for shell execution and improve tool call bubble UI
2 parents ee06e30 + 094e880 commit 05e440d

File tree

4 files changed

+40
-21
lines changed

4 files changed

+40
-21
lines changed

core/src/main/kotlin/cc/unitmesh/devti/sketch/run/ProcessExecutor.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import com.intellij.openapi.progress.ProgressManager
2626
import com.intellij.openapi.progress.Task
2727
import com.intellij.openapi.progress.impl.BackgroundableProcessIndicator
2828
import com.intellij.openapi.project.Project
29-
import com.intellij.openapi.project.ProjectManager
3029
import com.intellij.openapi.projectRoots.ProjectJdkTable
3130
import com.intellij.openapi.projectRoots.Sdk
3231
import com.intellij.openapi.roots.ProjectRootManager
@@ -126,7 +125,7 @@ class ProcessExecutor(val project: Project) {
126125
}
127126

128127
private fun createProcess(shellScript: String): Process {
129-
val basedir = ProjectManager.getInstance().openProjects.firstOrNull()?.basePath
128+
val basedir = project.basePath
130129
val commandLine = PtyCommandLine()
131130
commandLine.withConsoleMode(false)
132131
commandLine.withUnixOpenTtyToPreserveOutputAfterTermination(true)

mpp-core/src/commonMain/kotlin/cc/unitmesh/agent/render/RendererUtils.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ object RendererUtils {
1818

1919
return when (toolType) {
2020
ToolType.ReadFile -> ToolCallDisplayInfo(
21-
toolName = "${params["path"] ?: "unknown"} - ${toolType.displayName}",
21+
toolName = toolType.displayName,
2222
description = "file reader",
2323
details = "Reading file: ${params["path"] ?: "unknown"}"
2424
)
2525

2626
ToolType.WriteFile -> ToolCallDisplayInfo(
27-
toolName = "${params["path"] ?: "unknown"} - ${toolType.displayName}",
27+
toolName = toolType.displayName,
2828
description = "file writer",
2929
details = "Writing to file: ${params["path"] ?: "unknown"}"
3030
)

mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/components/timeline/IdeaTerminalOutputBubble.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ fun IdeaTerminalOutputBubble(
4545
modifier: Modifier = Modifier,
4646
project: Project? = null
4747
) {
48-
var expanded by remember { mutableStateOf(true) }
48+
var expanded by remember { mutableStateOf(false) }
4949

5050
Box(
5151
modifier = modifier

mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/components/timeline/IdeaToolCallBubble.kt

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ import androidx.compose.foundation.shape.RoundedCornerShape
1313
import androidx.compose.runtime.*
1414
import androidx.compose.ui.Alignment
1515
import androidx.compose.ui.Modifier
16+
import androidx.compose.ui.draw.clipToBounds
1617
import androidx.compose.ui.text.font.FontFamily
1718
import androidx.compose.ui.text.font.FontWeight
19+
import androidx.compose.ui.text.style.TextOverflow
1820
import androidx.compose.ui.unit.dp
1921
import androidx.compose.ui.unit.sp
2022
import cc.unitmesh.agent.render.TimelineItem
@@ -68,7 +70,7 @@ fun IdeaToolCallBubble(
6870
.padding(8.dp)
6971
) {
7072
Column {
71-
// Header row: Status + Tool name + Summary + Expand icon
73+
// Header row: Status + Tool name + Output (dynamic) + Time + Expand icon
7274
Row(
7375
modifier = Modifier
7476
.fillMaxWidth()
@@ -99,17 +101,17 @@ fun IdeaToolCallBubble(
99101
}
100102
)
101103

102-
// Tool name
104+
// Tool name (fixed width, no shrink)
103105
Text(
104106
text = item.toolName,
105107
style = JewelTheme.defaultTextStyle.copy(fontWeight = FontWeight.Bold),
106-
modifier = Modifier.weight(1f)
108+
maxLines = 1
107109
)
108110

109-
// Summary (truncated params as summary)
110-
if (hasParams && !expanded) {
111+
// Output summary (dynamic width, fills remaining space)
112+
if (hasOutput && !expanded) {
111113
Text(
112-
text = "-> ${item.params.take(40)}${if (item.params.length > 40) "..." else ""}",
114+
text = "-> ${item.output?.replace("\n", " ")?.trim() ?: ""}",
113115
style = JewelTheme.defaultTextStyle.copy(
114116
fontSize = 12.sp,
115117
color = when {
@@ -118,8 +120,32 @@ fun IdeaToolCallBubble(
118120
else -> JewelTheme.globalColors.text.info
119121
}
120122
),
121-
maxLines = 1
123+
maxLines = 1,
124+
overflow = TextOverflow.Ellipsis,
125+
modifier = Modifier
126+
.weight(1f)
127+
.clipToBounds()
122128
)
129+
} else if (!expanded) {
130+
// Show params as fallback when no output
131+
if (hasParams) {
132+
Text(
133+
text = "-> ${item.params.replace("\n", " ").trim()}",
134+
style = JewelTheme.defaultTextStyle.copy(
135+
fontSize = 12.sp,
136+
color = JewelTheme.globalColors.text.info
137+
),
138+
maxLines = 1,
139+
overflow = TextOverflow.Ellipsis,
140+
modifier = Modifier
141+
.weight(1f)
142+
.clipToBounds()
143+
)
144+
} else {
145+
Spacer(modifier = Modifier.weight(1f))
146+
}
147+
} else {
148+
Spacer(modifier = Modifier.weight(1f))
123149
}
124150

125151
// Execution time (if available)
@@ -376,14 +402,8 @@ private fun copyToClipboard(text: String) {
376402

377403
/**
378404
* Format tool output for better readability.
379-
* Returns output as-is to avoid breaking valid JSON/table formats.
405+
* Returns output as-is to preserve valid JSON/table formats.
406+
* No fixed truncation - UI handles overflow dynamically.
380407
*/
381-
private fun formatToolOutput(output: String): String {
382-
return when {
383-
output.contains("|") -> output // Table format
384-
output.contains("\n") -> output // Already formatted
385-
output.length > 100 -> "${output.take(100)}..." // Truncate long single-line output
386-
else -> output
387-
}
388-
}
408+
private fun formatToolOutput(output: String): String = output
389409

0 commit comments

Comments
 (0)