fix: prefer completed mcp tool trace rows
This commit is contained in:
@@ -393,7 +393,7 @@ function isToolTraceEvent(event: TraceEvent): boolean {
|
||||
function isToolStartTraceEvent(event: TraceEvent): boolean {
|
||||
const status = String(event.status ?? "").toLowerCase();
|
||||
const label = String(event.label ?? "");
|
||||
return status === "started" || /:started$|\/started$/u.test(label);
|
||||
return ["started", "running", "inprogress", "in-progress"].includes(status) || /:started$|\/started$/u.test(label);
|
||||
}
|
||||
|
||||
function isToolCompleteTraceEvent(event: TraceEvent): boolean {
|
||||
@@ -516,11 +516,12 @@ function traceMarkdownFence(language: string, body: string): string {
|
||||
}
|
||||
|
||||
function traceStatusToken(event: TraceEvent): string {
|
||||
const status = String(event.status ?? "");
|
||||
const rawStatus = String(event.status ?? "");
|
||||
const status = rawStatus.toLowerCase();
|
||||
if (status === "completed" || status === "succeeded") return "ok";
|
||||
if (["failed", "blocked", "error", "timeout", "canceled"].includes(status) || event.errorCode) return "fail";
|
||||
if (["started", "running", "accepted"].includes(status)) return "run";
|
||||
return status || "event";
|
||||
if (["started", "running", "accepted", "inprogress", "in-progress"].includes(status)) return "run";
|
||||
return rawStatus || "event";
|
||||
}
|
||||
|
||||
function traceEventTone(event: TraceEvent): TraceEventRow["tone"] {
|
||||
|
||||
Reference in New Issue
Block a user