llm-stream-reformat
v0.1.0
Published
Inflight LLM-stream reformatting — separate a reasoning model's thinking from its answer, collapse repetition, and normalize whitespace, while the tokens are still arriving. Parses Google Vertex / OpenRouter / meta-llm SSE. Rust + WASM (built on ruvnet/mi
Maintainers
Readme
llm-stream-reformat
Reformat a live LLM token stream while it's still arriving — separate a reasoning model's thinking from its answer, collapse repetition loops, and normalize whitespace. Parses Google Vertex (gemini-3.7-flash), OpenRouter, and meta-llm SSE.
Rust + WebAssembly, built on the real ruvnet/midstream temporal-compare primitive. Node + browser.
npm install llm-stream-reformatconst { Reformatter } = require('llm-stream-reformat');
const rf = new Reformatter();
for (const line of sseLines) {
for (const ev of rf.pushSse('google', line)) {
if (ev.channel === 'thinking') showReasoning(ev.text);
else appendAnswer(ev.text);
}
}
rf.finish().forEach(ev => appendAnswer(ev.text));Browser: import { init, Reformatter } from 'llm-stream-reformat/web'; await init();
Design: ADR-390. MIT © rUv.
