Improve OpenClaw delta parsing and live stream coalescing

This commit is contained in:
Dotta
2026-03-06 08:34:51 -06:00
parent 38d3d5fa59
commit 854e818b74
4 changed files with 116 additions and 12 deletions

View File

@@ -74,6 +74,21 @@ describe("openclaw ui stdout parser", () => {
]);
});
it("parses stdout-prefixed SSE deltas and preserves spacing", () => {
const ts = "2026-03-05T23:07:16.296Z";
const line =
'stdout[openclaw:sse] event=response.output_text.delta data={"type":"response.output_text.delta","delta":" can"}';
expect(parseOpenClawStdoutLine(line, ts)).toEqual([
{
kind: "assistant",
ts,
text: " can",
delta: true,
},
]);
});
it("parses response.completed into usage-aware result entries", () => {
const ts = "2026-03-05T23:07:20.269Z";
const line = JSON.stringify({
@@ -128,6 +143,19 @@ describe("openclaw ui stdout parser", () => {
},
]);
});
it("maps stderr-prefixed lines to stderr transcript entries", () => {
const ts = "2026-03-05T23:07:20.269Z";
const line = "stderr OpenClaw transport error";
expect(parseOpenClawStdoutLine(line, ts)).toEqual([
{
kind: "stderr",
ts,
text: "OpenClaw transport error",
},
]);
});
});
describe("openclaw adapter execute", () => {