Clarify subagent coordination cards
This commit is contained in:
1 parent
cad0cbcfbe
commit
898e6b92d0
5 files changed
+152
-21
No files matched your search
@@ -295,12 +295,14 @@ fun ToolCard(
|
||||
shape: Shape = CardDefaults.shape,
|
||||
) {
|
||||
val parsed = remember(tool.tool, tool.input) { parseToolInput(tool.tool, tool.input) }
|
||||
val name = toolDisplayName(tool.tool)
|
||||
val output = toolDisplayOutput(tool.tool, tool.output)
|
||||
val deciding = tool.asks.any { it.answers.isEmpty() }
|
||||
val open = expanded || deciding
|
||||
Card(Modifier.fillMaxWidth().clickable(onClick = onToggle), shape = shape) {
|
||||
Column(Modifier.padding(GROUP_INSET_LARGE)) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Text(tool.tool, style = MaterialTheme.typography.titleSmall)
|
||||
Text(name, style = MaterialTheme.typography.titleSmall)
|
||||
if (open) {
|
||||
Spacer(Modifier.weight(1f))
|
||||
parsed.timeout?.let {
|
||||
@@ -355,7 +357,7 @@ fun ToolCard(
|
||||
if (tool.tool != ASK_USER_QUESTION) {
|
||||
ToolInputView(tool.tool, tool.input, Modifier.padding(top = 4.dp))
|
||||
}
|
||||
if (tool.output.isNotEmpty()) {
|
||||
if (output.isNotEmpty()) {
|
||||
Spacer(Modifier.height(8.dp))
|
||||
Text("Output", style = MaterialTheme.typography.labelSmall)
|
||||
// What the tool printed, on the surface everything verbatim gets and in the
|
||||
@@ -367,7 +369,7 @@ fun ToolCard(
|
||||
// often the whole of what a diff or a test run is saying. Remembered against
|
||||
// the text, so a card that is open through a scroll parses once.
|
||||
val palette = remember { ansiPalette() }
|
||||
val styled = remember(tool.output, palette) { ansiStyled(tool.output, palette) }
|
||||
val styled = remember(output, palette) { ansiStyled(output, palette) }
|
||||
RawBlock(Modifier.padding(top = 2.dp)) {
|
||||
Text(
|
||||
styled,
|
||||
@@ -391,6 +393,22 @@ fun ToolCard(
|
||||
}
|
||||
}
|
||||
|
||||
private val collaborationToolNames =
|
||||
mapOf(
|
||||
"Task" to "Spawn agent",
|
||||
"TaskOutput" to "Wait for agents",
|
||||
"SendMessage" to "Message agent",
|
||||
"CloseAgent" to "Close agent",
|
||||
"InterruptAgent" to "Interrupt agent",
|
||||
"ListAgents" to "List agents",
|
||||
"ResumeAgent" to "Resume agent",
|
||||
)
|
||||
|
||||
internal fun toolDisplayName(tool: String): String = collaborationToolNames[tool] ?: tool
|
||||
|
||||
internal fun toolDisplayOutput(tool: String, output: String): String =
|
||||
if (tool in collaborationToolNames && output == "completed") "" else output
|
||||
|
||||
/**
|
||||
* The permission ask on the call it is about.
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user