fix: normalize workflow-result records to match ThreadRecord shape

Both REST and SSE endpoints now return workflow-result with standard
fields (role, content, timestamp) instead of non-standard (summary).
Fixes 'Invalid Date' and empty content in dashboard.

小橘 <xiaoju@shazhou.work>
This commit is contained in:
2026-05-09 10:24:48 +00:00
parent e0577ceefe
commit cb756a999a
2 changed files with 2 additions and 2 deletions
@@ -118,7 +118,7 @@ async function emitRecordsForHead(params: {
params.eventId.n++;
await params.stream.writeSSE({
event: "record",
data: JSON.stringify({ type: "workflow-result", ...wf }),
data: JSON.stringify({ type: "workflow-result", role: null, content: wf.summary, timestamp: null, returnCode: wf.returnCode }),
id: String(params.eventId.n),
});
return true;
@@ -42,7 +42,7 @@ async function buildThreadDetailRecords(
const returnCode = fr.payload.meta.returnCode;
const summary = fr.payload.meta.summary;
if (typeof returnCode === "number" && typeof summary === "string") {
records.push({ type: "workflow-result", returnCode, summary });
records.push({ type: "workflow-result", role: null, content: summary, timestamp: null, returnCode });
}
continue;
}