mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-16 02:40:39 +09:00
Improve OpenClaw delta parsing and live stream coalescing
This commit is contained in:
parent
38d3d5fa59
commit
854e818b74
4 changed files with 116 additions and 12 deletions
|
|
@ -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", () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue