Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ enum class AgentType {
/**
* Remote agent mode - connects to remote mpp-server for distributed execution
*/
REMOTE;
REMOTE,

/**
* Web edit mode - browse, select DOM elements, and interact with web pages
*/
WEB_EDIT;

fun getDisplayName(): String = when (this) {
LOCAL_CHAT -> "Chat"
Expand All @@ -49,6 +54,7 @@ enum class AgentType {
KNOWLEDGE -> "Knowledge"
CHAT_DB -> "ChatDB"
REMOTE -> "Remote"
WEB_EDIT -> "WebEdit"
}

companion object {
Expand All @@ -60,6 +66,7 @@ enum class AgentType {
"codereview" -> CODE_REVIEW
"documentreader", "documents" -> KNOWLEDGE
"chatdb", "database" -> CHAT_DB
"webedit", "web" -> WEB_EDIT
else -> LOCAL_CHAT
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ private fun SegmentedAgentTabs(
// Note: LOCAL_CHAT is intentionally excluded from the tabs as it represents
// a different interaction mode (direct local chat without agent routing).
// It's handled separately in IdeaAgentApp but not exposed as a user-selectable tab.
val agentTypes = listOf(AgentType.CODING, AgentType.CODE_REVIEW, AgentType.KNOWLEDGE, AgentType.REMOTE)
val agentTypes = listOf(AgentType.CODING, AgentType.CODE_REVIEW, AgentType.KNOWLEDGE, AgentType.REMOTE, AgentType.WEB_EDIT)

Row(
modifier = modifier
Expand Down Expand Up @@ -259,6 +259,7 @@ private fun getAgentTypeColor(type: AgentType): Color = when (type) {
AgentType.CHAT_DB -> IdeaAutoDevColors.Cyan.c400
AgentType.REMOTE -> IdeaAutoDevColors.Amber.c400
AgentType.LOCAL_CHAT -> JewelTheme.globalColors.text.normal
AgentType.WEB_EDIT -> IdeaAutoDevColors.Blue.c400
}

/**
Expand All @@ -271,5 +272,6 @@ private fun getAgentTypeIcon(type: AgentType): ImageVector = when (type) {
AgentType.CHAT_DB -> IdeaComposeIcons.Database
AgentType.REMOTE -> IdeaComposeIcons.Cloud
AgentType.LOCAL_CHAT -> IdeaComposeIcons.Chat
AgentType.WEB_EDIT -> IdeaComposeIcons.Web
}

Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import cc.unitmesh.devins.idea.toolwindow.knowledge.IdeaKnowledgeViewModel
import cc.unitmesh.devins.idea.toolwindow.remote.IdeaRemoteAgentContent
import cc.unitmesh.devins.idea.toolwindow.remote.IdeaRemoteAgentViewModel
import cc.unitmesh.devins.idea.toolwindow.remote.getEffectiveProjectId
import cc.unitmesh.devins.idea.toolwindow.webedit.IdeaWebEditContent
import cc.unitmesh.devins.idea.toolwindow.webedit.IdeaWebEditViewModel
import cc.unitmesh.devins.idea.components.status.IdeaToolLoadingStatusBar
import cc.unitmesh.devins.idea.components.timeline.IdeaEmptyStateMessage
import cc.unitmesh.devins.idea.components.timeline.IdeaTimelineContent
Expand Down Expand Up @@ -128,6 +130,9 @@ fun IdeaAgentApp(
// Remote Agent ViewModel (created lazily when needed)
var remoteAgentViewModel by remember { mutableStateOf<IdeaRemoteAgentViewModel?>(null) }

// WebEdit ViewModel (created lazily when needed)
var webEditViewModel by remember { mutableStateOf<IdeaWebEditViewModel?>(null) }

// Remote agent state for input handling
var remoteProjectId by remember { mutableStateOf("") }
var remoteGitUrl by remember { mutableStateOf("") }
Expand Down Expand Up @@ -159,6 +164,9 @@ fun IdeaAgentApp(
serverUrl = "http://localhost:8080"
)
}
if (currentAgentType == AgentType.WEB_EDIT && webEditViewModel == null) {
webEditViewModel = IdeaWebEditViewModel(project, coroutineScope)
}
}

// Dispose ViewModels when leaving their tabs
Expand All @@ -176,6 +184,10 @@ fun IdeaAgentApp(
remoteAgentViewModel?.dispose()
remoteAgentViewModel = null
}
if (currentAgentType != AgentType.WEB_EDIT) {
webEditViewModel?.dispose()
webEditViewModel = null
}
}
}

Expand Down Expand Up @@ -362,9 +374,15 @@ fun IdeaAgentApp(
} ?: IdeaEmptyStateMessage("Loading Knowledge Agent...")
}
}
AgentType.WEB_EDIT -> {
// WebEdit mode - Browse web pages and select DOM elements
Box(modifier = Modifier.fillMaxWidth().weight(1f)) {
webEditViewModel?.let { vm ->
IdeaWebEditContent(viewModel = vm)
} ?: IdeaEmptyStateMessage("Loading WebEdit Agent...")
}
}
AgentType.CHAT_DB -> {
// ChatDB mode - Text2SQL agent for database queries
// TODO: Implement ChatDB UI when ready
Box(modifier = Modifier.fillMaxWidth().weight(1f)) {
IdeaEmptyStateMessage("ChatDB Agent coming soon...")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1793,5 +1793,158 @@ object IdeaComposeIcons {
}.build()
}

/**
* ArrowBack icon (left arrow)
*/
val ArrowBack: ImageVector by lazy {
ImageVector.Builder(
name = "ArrowBack",
defaultWidth = 24.dp,
defaultHeight = 24.dp,
viewportWidth = 24f,
viewportHeight = 24f
).apply {
path(
fill = SolidColor(Color.Black)
) {
moveTo(20f, 11f)
horizontalLineTo(7.83f)
lineToRelative(5.59f, -5.59f)
lineTo(12f, 4f)
lineToRelative(-8f, 8f)
lineToRelative(8f, 8f)
lineToRelative(1.41f, -1.41f)
lineTo(7.83f, 13f)
horizontalLineTo(20f)
verticalLineToRelative(-2f)
close()
}
}.build()
}

/**
* ArrowForward icon (right arrow)
*/
val ArrowForward: ImageVector by lazy {
ImageVector.Builder(
name = "ArrowForward",
defaultWidth = 24.dp,
defaultHeight = 24.dp,
viewportWidth = 24f,
viewportHeight = 24f
).apply {
path(
fill = SolidColor(Color.Black)
) {
moveTo(12f, 4f)
lineToRelative(-1.41f, 1.41f)
lineTo(16.17f, 11f)
horizontalLineTo(4f)
verticalLineToRelative(2f)
horizontalLineToRelative(12.17f)
lineToRelative(-5.58f, 5.59f)
lineTo(12f, 20f)
lineToRelative(8f, -8f)
close()
}
}.build()
}

/**
* TouchApp icon (finger touch)
*/
val TouchApp: ImageVector by lazy {
ImageVector.Builder(
name = "TouchApp",
defaultWidth = 24.dp,
defaultHeight = 24.dp,
viewportWidth = 24f,
viewportHeight = 24f
).apply {
path(
fill = SolidColor(Color.Black)
) {
moveTo(9f, 11.24f)
verticalLineTo(7.5f)
curveTo(9f, 6.12f, 10.12f, 5f, 11.5f, 5f)
reflectiveCurveTo(14f, 6.12f, 14f, 7.5f)
verticalLineToRelative(3.74f)
curveToRelative(1.21f, -0.81f, 2f, -2.18f, 2f, -3.74f)
curveTo(16f, 5.01f, 13.99f, 3f, 11.5f, 3f)
reflectiveCurveTo(7f, 5.01f, 7f, 7.5f)
curveToRelative(0f, 1.56f, 0.79f, 2.93f, 2f, 3.74f)
close()
moveTo(18.84f, 15.87f)
lineToRelative(-4.54f, -2.26f)
curveToRelative(-0.17f, -0.07f, -0.35f, -0.11f, -0.54f, -0.11f)
horizontalLineTo(13f)
verticalLineToRelative(-6f)
curveTo(13f, 6.67f, 12.33f, 6f, 11.5f, 6f)
reflectiveCurveTo(10f, 6.67f, 10f, 7.5f)
verticalLineToRelative(10.74f)
lineToRelative(-3.43f, -0.72f)
curveToRelative(-0.08f, -0.01f, -0.15f, -0.03f, -0.24f, -0.03f)
curveToRelative(-0.31f, 0f, -0.59f, 0.13f, -0.79f, 0.33f)
lineToRelative(-0.79f, 0.8f)
lineToRelative(4.94f, 4.94f)
curveToRelative(0.27f, 0.27f, 0.65f, 0.44f, 1.06f, 0.44f)
horizontalLineToRelative(6.79f)
curveToRelative(0.75f, 0f, 1.33f, -0.55f, 1.44f, -1.28f)
lineToRelative(0.75f, -5.27f)
curveToRelative(0.01f, -0.07f, 0.02f, -0.14f, 0.02f, -0.2f)
curveToRelative(0f, -0.62f, -0.38f, -1.16f, -0.91f, -1.38f)
close()
}
}.build()
}

/**
* Web icon (globe)
*/
val Web: ImageVector by lazy {
ImageVector.Builder(
name = "Web",
defaultWidth = 24.dp,
defaultHeight = 24.dp,
viewportWidth = 24f,
viewportHeight = 24f
).apply {
path(
fill = SolidColor(Color.Black)
) {
moveTo(12f, 2f)
curveTo(6.48f, 2f, 2f, 6.48f, 2f, 12f)
reflectiveCurveToRelative(4.48f, 10f, 10f, 10f)
reflectiveCurveToRelative(10f, -4.48f, 10f, -10f)
reflectiveCurveTo(17.52f, 2f, 12f, 2f)
close()
moveTo(11f, 19.93f)
curveToRelative(-3.95f, -0.49f, -7f, -3.85f, -7f, -7.93f)
curveToRelative(0f, -0.62f, 0.08f, -1.21f, 0.21f, -1.79f)
lineTo(9f, 15f)
verticalLineToRelative(1f)
curveToRelative(0f, 1.1f, 0.9f, 2f, 2f, 2f)
verticalLineToRelative(1.93f)
close()
moveTo(17.9f, 17.39f)
curveToRelative(-0.26f, -0.81f, -1f, -1.39f, -1.9f, -1.39f)
horizontalLineToRelative(-1f)
verticalLineToRelative(-3f)
curveToRelative(0f, -0.55f, -0.45f, -1f, -1f, -1f)
horizontalLineTo(8f)
verticalLineToRelative(-2f)
horizontalLineToRelative(2f)
curveToRelative(0.55f, 0f, 1f, -0.45f, 1f, -1f)
verticalLineTo(7f)
horizontalLineToRelative(2f)
curveToRelative(1.1f, 0f, 2f, -0.9f, 2f, -2f)
verticalLineToRelative(-0.41f)
curveToRelative(2.93f, 1.19f, 5f, 4.06f, 5f, 7.41f)
curveToRelative(0f, 2.08f, -0.8f, 3.97f, -2.1f, 5.39f)
close()
}
}.build()
}

}

Loading
Loading