#419

createJsonRenderTransform: reset fence and line-buffer state at each text block and step

Openpeter-cynomiopened 20d ago

Version: @json-render/core 0.21.0

createJsonRenderTransform keeps inSpecFence and lineBuffer for the whole stream. text-end flushes the buffer but leaves inSpecFence set, and text-start, start-step, error and abort chunks reset nothing. When a text block ends inside an open ```spec fence, for example when the model stops mid-block or an attempt fails and is retried, the next text block or the retried attempt is parsed as fence content, and its prose is lost.

Repro

Pipe these UI chunks through createJsonRenderTransform():

text-start 1
text-delta 1 "```spec\n"
text-end 1
text-start 2
text-delta 2 "Plain prose.\n"
text-end 2
  • Expected: Plain prose.\n streams as prose in block 2.
  • Actual: nothing is emitted for block 2. The line is treated as fence content that doesn't parse, and it is dropped.

Ask

Reset inSpecFence and lineBuffer, flushing the buffer first, at text-end/text-start, and at start-step, error and abort.

Activity

0

No activity yet.