fix(auto-reply): coalesce block replies and document streaming toggles (#536) (thanks @mcinteerj)

This commit is contained in:
Peter Steinberger
2026-01-09 18:19:55 +00:00
parent a05916bee8
commit fd15704c77
18 changed files with 714 additions and 99 deletions

View File

@@ -1045,6 +1045,15 @@ export function subscribeEmbeddedPiSession(params: {
stream: "lifecycle",
data: { phase: "end" },
});
if (params.onBlockReply) {
if (blockChunker?.hasBuffered()) {
blockChunker.drain({ force: true, emit: emitBlockChunk });
blockChunker.reset();
} else if (blockBuffer.length > 0) {
emitBlockChunk(blockBuffer);
blockBuffer = "";
}
}
if (pendingCompactionRetry > 0) {
resolveCompactionRetry();
} else {