feat: show reasoning duration after thinking phase

This commit is contained in:
mitchell 2026-05-05 04:07:54 -04:00
parent 7f0498fc84
commit a6422c51aa

View file

@ -88,6 +88,8 @@ export default class Renderer {
async renderStream(stream: AsyncIterableStream<TextStreamPart<ToolSet>>) {
this.resetCounts();
let reasonStart = 0;
const spin = spinner({ withGuide: false, indicator: "timer" });
if (!this.isPlain) {
spin.start("Waiting for response");
@ -96,6 +98,7 @@ export default class Renderer {
for await (const part of stream) {
switch (part.type) {
case "reasoning-start": {
reasonStart = Date.now();
spin.clear();
if (supportsColorStderr)
this.write(
@ -118,6 +121,8 @@ export default class Renderer {
} else {
this.write("\n--- Done Thinking ---\n", process.stderr);
}
const time = (Date.now() - reasonStart) / 1000;
this.write(`Thought for ${time.toFixed(2)}s\n`, process.stderr);
if (supportsColorStderr)
this.write(