Show live stage notes in activity panel

This commit is contained in:
wuyang6
2026-05-13 15:42:38 +08:00
parent b5e8b2f218
commit 01d148ec93
2 changed files with 19 additions and 5 deletions
@@ -911,6 +911,23 @@ function collectLiveRunItems(runStatus: ClawRunStatus | null) {
} }
seenToolCalls.add(event.tool_call_id); seenToolCalls.add(event.tool_call_id);
const result = resultById.get(event.tool_call_id); const result = resultById.get(event.tool_call_id);
const stageNote =
typeof event.assistant_content === "string"
? event.assistant_content.trim()
: "";
if (stageNote) {
items.push({
id: `live:${runStatus.run_id ?? runStatus.session_id ?? "active"}:${event.tool_call_id}:stage`,
kind: "reasoning",
title: "阶段说明",
summary: stageNote,
status: result
? result.ok === false
? "incomplete"
: "complete"
: "running",
});
}
const resultSummary = const resultSummary =
typeof result?.metadata?.output_preview === "string" typeof result?.metadata?.output_preview === "string"
? result.metadata.output_preview ? result.metadata.output_preview
@@ -605,11 +605,8 @@ function summarizeRunEvents(runStatus: ClawActiveRunStatus) {
? event.assistant_content.trim() ? event.assistant_content.trim()
: ""; : "";
lines.push( lines.push(
stageNote.startsWith("进度:") || stageNote.startsWith("进度:") stageNote ||
? stageNote (event.tool_name ? `调用工具 ${event.tool_name}` : "正在调用工具"),
: event.tool_name
? `调用工具 ${event.tool_name}`
: "正在调用工具",
); );
} }
if (event.type === "tool_result") { if (event.type === "tool_result") {