Skip to content

Commit 642aa76

Browse files
committed
refactor(renderer): remove RendererType enum and related exports #453
Eliminates the RendererType enum and its JS export, simplifying the renderer interface and reducing unused code.
1 parent c0c4db0 commit 642aa76

File tree

2 files changed

+8
-33
lines changed

2 files changed

+8
-33
lines changed
Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,29 @@
11
package cc.unitmesh.agent.render
22

3-
/**
4-
* Core renderer interface for CodingAgent
5-
* Defines the contract for all renderer implementations
6-
*/
73
interface CodingAgentRenderer {
8-
// Lifecycle methods
94
fun renderIterationHeader(current: Int, max: Int)
105
fun renderLLMResponseStart()
116
fun renderLLMResponseChunk(chunk: String)
127
fun renderLLMResponseEnd()
138

14-
// Tool execution methods
159
fun renderToolCall(toolName: String, paramsStr: String)
16-
fun renderToolResult(toolName: String, success: Boolean, output: String?, fullOutput: String?, metadata: Map<String, String> = emptyMap())
10+
fun renderToolResult(
11+
toolName: String,
12+
success: Boolean,
13+
output: String?,
14+
fullOutput: String?,
15+
metadata: Map<String, String> = emptyMap()
16+
)
1717

18-
// Status and completion methods
1918
fun renderTaskComplete()
2019
fun renderFinalResult(success: Boolean, message: String, iterations: Int)
2120
fun renderError(message: String)
2221
fun renderRepeatWarning(toolName: String, count: Int)
2322

24-
// Error recovery methods
2523
fun renderRecoveryAdvice(recoveryAdvice: String)
2624

27-
// Policy and permission methods
2825
fun renderUserConfirmationRequest(toolName: String, params: Map<String, Any>)
29-
30-
/**
31-
* Add live terminal session (optional, for PTY-enabled platforms)
32-
* Default implementation does nothing - override in renderers that support live terminals
33-
*/
26+
3427
fun addLiveTerminal(
3528
sessionId: String,
3629
command: String,
@@ -40,13 +33,3 @@ interface CodingAgentRenderer {
4033
// Default: no-op for renderers that don't support live terminals
4134
}
4235
}
43-
44-
/**
45-
* Renderer type enumeration for different UI implementations
46-
*/
47-
enum class RendererType {
48-
CONSOLE, // Default console output
49-
CLI, // Enhanced CLI with colors and formatting
50-
TUI, // Terminal UI with interactive elements
51-
WEB // Web-based UI
52-
}

mpp-core/src/jsMain/kotlin/cc/unitmesh/agent/RendererExports.kt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package cc.unitmesh.agent
22

33
import cc.unitmesh.agent.render.CodingAgentRenderer
4-
import cc.unitmesh.agent.render.RendererType
54
import kotlin.js.JsExport
65

76
/**
@@ -42,13 +41,6 @@ object RendererFactory {
4241
fun createRenderer(jsRenderer: JsCodingAgentRenderer): CodingAgentRenderer {
4342
return JsRendererAdapter(jsRenderer)
4443
}
45-
46-
/**
47-
* Get renderer type information for JS consumers
48-
*/
49-
fun getRendererTypes(): Array<String> {
50-
return RendererType.values().map { it.name }.toTypedArray()
51-
}
5244
}
5345

5446
/**

0 commit comments

Comments
 (0)