Show byre's tools by plain name in the transcript
This commit is contained in:
+14
-2
@@ -468,7 +468,7 @@ export function mountChat(root: HTMLElement, src: ChatSource, makeHead: (rerende
|
||||
continue;
|
||||
}
|
||||
if (ev.kind === "agent.tool_call") {
|
||||
addToRun(renderToolCall(p, ctx), { name: String(p["name"]), target: toolTarget(p["input"], ctx.root()) }, parent);
|
||||
addToRun(renderToolCall(p, ctx), { name: toolLabel(String(p["name"])), target: toolTarget(p["input"], ctx.root()) }, parent);
|
||||
continue;
|
||||
}
|
||||
const el = renderEvent(ev, ctx);
|
||||
@@ -816,12 +816,24 @@ function renderToolCall(p: Record<string, unknown>, ctx: Ctx): HTMLElement {
|
||||
return h(
|
||||
"details",
|
||||
{ class: "tool" },
|
||||
h("summary", {}, subagentTag(parentOf(p), ctx), h("span", { class: "tool-name" }, String(p["name"])), " ", h("span", { class: "tool-brief" }, toolBrief(p["input"], ctx.root()))),
|
||||
h("summary", {}, subagentTag(parentOf(p), ctx), h("span", { class: "tool-name" }, toolLabel(String(p["name"]))), " ", h("span", { class: "tool-brief" }, toolBrief(p["input"], ctx.root()))),
|
||||
copyable(h("pre", { class: "tool-input" }, JSON.stringify(p["input"], null, 2))),
|
||||
result,
|
||||
);
|
||||
}
|
||||
|
||||
function toolLabel(name: string): string {
|
||||
const prefix = "mcp__byre__";
|
||||
if (!name.startsWith(prefix)) {
|
||||
return name;
|
||||
}
|
||||
return name
|
||||
.slice(prefix.length)
|
||||
.split("_")
|
||||
.map((w) => w.charAt(0).toUpperCase() + w.slice(1))
|
||||
.join(" ");
|
||||
}
|
||||
|
||||
function isSubagentCall(p: Record<string, unknown>): boolean {
|
||||
return p["name"] === "Agent" || p["name"] === "Task";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user