feat: show recent completed main agent runs
This commit is contained in:
@@ -984,6 +984,9 @@ function renderOneLinerRunsHtml() {
|
||||
const pendingRunCount = safeArray(runs).filter((item) => item.run_status === "needs_confirmation").length;
|
||||
const activeRunCount = safeArray(runs).filter((item) => ["queued", "running", "blocked"].includes(item.run_status)).length;
|
||||
const completedRunCount = safeArray(runs).filter((item) => item.run_status === "done").length;
|
||||
const recentCompletedRuns = safeArray(runs)
|
||||
.filter((item) => item.run_status === "done" && item.id !== currentRun.id)
|
||||
.slice(0, 3);
|
||||
const previewLandingAttrs = buildMainAgentLandingAttrs({
|
||||
runId: currentRun.id || "",
|
||||
screen: previewAction?.screen || "",
|
||||
@@ -1109,6 +1112,33 @@ function renderOneLinerRunsHtml() {
|
||||
`).join("")}
|
||||
</div>
|
||||
` : ""}
|
||||
${recentCompletedRuns.length ? `
|
||||
<div class="task-item compact" style="margin-top:10px;">
|
||||
<h4>最近完成</h4>
|
||||
<div class="list" style="margin-top:10px;">
|
||||
${recentCompletedRuns.map((item) => {
|
||||
const doneAction = item.result?.recommended_action || null;
|
||||
const doneLandingAttrs = buildMainAgentLandingAttrs({
|
||||
runId: item.id || "",
|
||||
screen: doneAction?.screen || "",
|
||||
title: item.title || item.plan?.goal || "主 Agent 任务",
|
||||
summary: doneAction?.summary || item.status_summary || ""
|
||||
});
|
||||
return `
|
||||
<div class="task-item compact">
|
||||
<h4>${escapeHtml(item.title || item.plan?.goal || "主 Agent 任务")}</h4>
|
||||
<p>${escapeHtml(item.status_summary || item.summary || "已完成,可继续回看结果。")}</p>
|
||||
<div class="task-meta">
|
||||
<span class="tag green">已完成</span>
|
||||
<span class="tag clickable-tag" data-action="open-oneliner-run-result" data-run-id="${escapeHtml(item.id)}">查看结果</span>
|
||||
${doneAction?.action ? `<span class="tag clickable-tag" data-action="${escapeHtml(doneAction.action)}" ${doneLandingAttrs}>${escapeHtml(doneAction.label || "回到对应页面")}</span>` : ""}
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
}).join("")}
|
||||
</div>
|
||||
</div>
|
||||
` : ""}
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
@@ -307,6 +307,8 @@ test("oneliner runtime shows grouped run health summary above the current run ca
|
||||
assert.match(runtime, /待确认/);
|
||||
assert.match(runtime, /执行中/);
|
||||
assert.match(runtime, /已完成/);
|
||||
assert.match(runtime, /最近完成/);
|
||||
assert.match(runtime, /recentCompletedRuns/);
|
||||
assert.match(runtime, /safeArray\(runs\)\.filter\(\(item\) => item\.run_status === "needs_confirmation"\)\.length/);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user