refactor: redirect reasoning output to stderr

This commit is contained in:
mitchell 2026-04-17 03:04:47 -04:00
parent 712666255a
commit 4716712a92
2 changed files with 38 additions and 38 deletions

View file

@ -78,25 +78,19 @@ async function main() {
});
const start = Date.now();
const streamRender = new StreamRenderer().renderStream(fullStream);
const [width] = process.stdout.getWindowSize();
const glow = Bun.spawn({
cmd: ["glow", "-w", `${width}`, "-"],
stdin: textStream,
stdout: "inherit",
});
await streamRender;
await new StreamRenderer().renderStream(fullStream);
const stop = Date.now();
await glow.exited;
convo.messages.push({ role: "assistant", content: await text });
await convoFile.write(JSON.stringify(convo));
const [width] = process.stdout.getWindowSize();
await Bun.spawn({
cmd: ["glow", "-w", `${width}`, "-"],
stdin: textStream,
stdout: "inherit",
}).exited;
const { inputTokens, outputTokens } = await totalUsage;
const context = (inputTokens ?? 0) / 1000;
const output = (outputTokens ?? 0) / 1000;