Plain text first
Deltas land in one pre. No text model, no worker, no layout thrash while the answer is still moving.
for await (const delta of stream)
output.append(delta)
output.getStats()
// renderMode: 'plain-text'Stream-native code rendering
Syntax highlighting and review-ready diffs for AI output. No Monaco, no workers, editable when you need it.
Start with append-only rendering. Upgrade to a review surface only when the content is complete.
Deltas land in one pre. No text model, no worker, no layout thrash while the answer is still moving.
for await (const delta of stream)
output.append(delta)
output.getStats()
// renderMode: 'plain-text'One final snapshot becomes an interactive file with Shiki highlighting. The stream already sits on the final metrics, so the text does not move.
await output.finalize({
view: 'file',
enableLineSelection: true,
})Generate the diff from the final text, not the partial tokens. Select, annotate, accept, or reject a hunk.
await output.finalize({
view: 'diff',
original: previous,
diffStyle: 'split',
})Every capability below ships in the controller. The playground uses the same API.
Read-only by default. startEditing() loads the editor lazily, waits for hydration, and hands you a real document with undo and redo.
const editor = await surface.startEditing({
onChange: event => queueSave(event.file),
}, 'review-draft')Attach review comments to a line. They survive rerenders and move with the edit session.
Keep the empty-id check before the request so the network layer never sees a bad key.
additions line 4surface.setAnnotations([
{ side: 'additions', lineNumber: 4, metadata },
])Controlled line selection, token hover, accept and reject. The resolved file is yours to save.
review.acceptReject(0, 'accept')
review.getResolvedFile()?.contentsResolve current, incoming, or both without leaving the page.
If both renderers are installed, stream-diffs wins. Existing CodeBlockNode usage stays the same.
<MarkdownRender
:content="markdown"
:loading="streaming"
/>Integration notesOn the measured Chrome benchmark, stream-diffs put a visible code surface on screen 92% sooner than stream-monaco and used 92% fewer renderer DOM nodes.
Chrome 150, 1440x1000, three repetitions. Methodology and commands live in the performance notes.
Read the benchmarkmedian cold fallback visible
stream-monaco: 913.0 msfirst-party runtime gzip
Excludes the lazy renderer payloadMonaco models or workers
Append-only streaming pathEdit two sources, switch unified and split, annotate a line, then start an inline editor on the rendered diff.

Stream plain text, land a highlighted file or diff, then edit in place.