feat(coding-agent): show tool name instead of result content in tree selector
This commit is contained in:
@@ -296,11 +296,15 @@ class TreeList implements Component {
|
|||||||
case "message": {
|
case "message": {
|
||||||
const msg = entry.message;
|
const msg = entry.message;
|
||||||
const role = msg.role;
|
const role = msg.role;
|
||||||
if (role === "user" || role === "assistant" || role === "toolResult") {
|
if (role === "user" || role === "assistant") {
|
||||||
const msgWithContent = msg as { content?: unknown };
|
const msgWithContent = msg as { content?: unknown };
|
||||||
const content = normalize(this.extractContent(msgWithContent.content));
|
const content = normalize(this.extractContent(msgWithContent.content));
|
||||||
const roleColor = role === "user" ? "accent" : role === "assistant" ? "success" : "muted";
|
const roleColor = role === "user" ? "accent" : "success";
|
||||||
result = theme.fg(roleColor, `${role}: `) + content;
|
result = theme.fg(roleColor, `${role}: `) + content;
|
||||||
|
} else if (role === "toolResult") {
|
||||||
|
const toolMsg = msg as { toolName?: string };
|
||||||
|
const toolName = toolMsg.toolName ?? "tool";
|
||||||
|
result = theme.fg("muted", `[${toolName}]`);
|
||||||
} else if (role === "bashExecution") {
|
} else if (role === "bashExecution") {
|
||||||
const bashMsg = msg as { command?: string };
|
const bashMsg = msg as { command?: string };
|
||||||
result = theme.fg("dim", `[bash]: ${normalize(bashMsg.command ?? "")}`);
|
result = theme.fg("dim", `[bash]: ${normalize(bashMsg.command ?? "")}`);
|
||||||
|
|||||||
Reference in New Issue
Block a user