Improve OpenClaw SSE transcript parsing and stream readability

This commit is contained in:
Dotta
2026-03-05 17:26:00 -06:00
parent 5134cac993
commit 81bc8c7313
5 changed files with 206 additions and 4 deletions

View File

@@ -3,9 +3,9 @@ import type { TranscriptEntry, StdoutLineParser } from "./types";
type RunLogChunk = { ts: string; stream: "stdout" | "stderr" | "system"; chunk: string };
function appendTranscriptEntry(entries: TranscriptEntry[], entry: TranscriptEntry) {
if (entry.kind === "thinking" && entry.delta) {
if ((entry.kind === "thinking" || entry.kind === "assistant") && entry.delta) {
const last = entries[entries.length - 1];
if (last && last.kind === "thinking" && last.delta) {
if (last && last.kind === entry.kind && last.delta) {
last.text += entry.text;
last.ts = entry.ts;
return;